/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pos.system.standard.ui;

import java.awt.Component;
import java.awt.Container;
import java.awt.Event;
import java.awt.FocusTraversalPolicy;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import native_display.SevenSegDisplay;
import pos.system.Constants;
import pos.system.Order;
import pos.system.OrderItem;
import pos.system.PosPrinter;
import pos.system.Role;
import pos.system.StockItem;
import pos.system.database.DBConstant;
import pos.system.database.MySqlConnector;
import pos.system.database.OrderDataTable;
import pos.system.database.OrderSearchTable;
import pos.system.database.ReportDataTable;
import pos.system.database.StockDataTable;
import pos.system.database.UserDataTable;
import pos.system.standard.ui.util.GuiUtil;

/**
 *
 * @author Shameera
 */
public final class MainWindow extends javax.swing.JFrame {

    private Action currentAction;
    private String current_user;
    private Role current_user_role;
    private MySqlConnector db_Connector;
    private boolean isAdditem;
    private Order order;
    private OrderDataTable orderDataTable = new OrderDataTable();
    private static int INVOICE_NUM = 0;
    private NumberFormat invoiceFormatter = new DecimalFormat("00000000");
    private NumberFormat moneyFormat = new DecimalFormat("###.00");
    private static String DATA_FILE = "data.txt";
    SevenSegDisplay ssd = new SevenSegDisplay();
    private boolean isPrinterPresent = true;

    /**
     * Creates new form MainWindow
     */
    private MainWindow() {
        try {
            initComponents();
            initCustomKeyBind();
            lineDisplay("0.00", "0");
            this.setLocation(0, 4);
            currentAction = Action.MAIN_WINDOW;
            setSizes();
            db_Connector = new MySqlConnector(DBConstant.DEFAULT_USERNAME, DBConstant.DEFAULT_PASSWORD);
            mainwindow_panel.requestFocusInWindow();
        } catch (SQLException ex) {
            Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public MainWindow(String username, Role role) {
        this();
        setCurrent_user(username, role);
        setPrivilage(role);
        searchByCode_Field.getDocument().addDocumentListener(new SearchCodeFieldDocumentListener());
        searchByName_Field.getDocument().addDocumentListener(new SearchNameFieldDocumentListener());
        try {
            File dataFile = new File(MainWindow.DATA_FILE);
            String inv = "1";
            if (!dataFile.exists()) {
                if (dataFile.createNewFile()) {
                } else {
                    JOptionPane.showMessageDialog(this, "Couldn't create data.txt file in the base dirctory please check the permission and try again", "Error", JOptionPane.ERROR_MESSAGE);
                    System.exit(0);
                }
            } else {
                BufferedReader br = new BufferedReader(new FileReader(dataFile));
                inv = br.readLine();
                br.close();
            }
            MainWindow.INVOICE_NUM = Integer.parseInt(inv);

        } catch (FileNotFoundException ex) {
            Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainwindow_mypanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        stockPanel = new javax.swing.JPanel();
        stockTableScrollPane = new javax.swing.JScrollPane();
        stockTable = new javax.swing.JTable();
        stock_addButton = new javax.swing.JButton();
        stock_backButton = new javax.swing.JButton();
        stock_editButton = new javax.swing.JButton();
        stock_deleteButton = new javax.swing.JButton();
        stock_cancelButton = new javax.swing.JButton();
        jLabel21 = new javax.swing.JLabel();
        stock_usernameLabel = new javax.swing.JLabel();
        dailyReportPanel = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        dailyReport_table = new javax.swing.JTable();
        dailyReport_showReportButton = new javax.swing.JButton();
        dailyReports_backButton = new javax.swing.JButton();
        dailyReport_yearCombo = new javax.swing.JComboBox();
        dailyReport_monthCombo = new javax.swing.JComboBox();
        dailyReport_dayCombo = new javax.swing.JComboBox();
        jLabel20 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        monthlyReportPanel = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        monthlyReport_table = new javax.swing.JTable();
        monthlyReport_showReportButton = new javax.swing.JButton();
        monthlyReports_backButton = new javax.swing.JButton();
        monthlyReport_monthCombo = new javax.swing.JComboBox();
        monthlyReport_yearCombo = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        usermanagementPanel = new javax.swing.JPanel();
        userManagement_addUserButton = new javax.swing.JButton();
        userManagement_editUserButton = new javax.swing.JButton();
        userManagement_deleteUserButton = new javax.swing.JButton();
        userManagement_BackButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        userTable = new javax.swing.JTable();
        jLabel2 = new javax.swing.JLabel();
        orderPanel = new javax.swing.JPanel();
        order_removeButton = new javax.swing.JButton();
        order_cancelButton = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        orderTable = new javax.swing.JTable();
        order_addButton = new javax.swing.JButton();
        order_backButton = new javax.swing.JButton();
        order_payButton = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        order_totalLabel = new javax.swing.JLabel();
        order_usernameLabel = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        order_invoiceLabel = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        editItemWindow = new javax.swing.JFrame();
        editItemPanel = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        editItem_sellerField = new javax.swing.JTextField();
        editItem_quantityField = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        editItem_priceField = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        editItem_ItemNameField = new javax.swing.JTextField();
        editItem_codeField = new javax.swing.JTextField();
        editItems_okButton = new javax.swing.JButton();
        editItems_backButton = new javax.swing.JButton();
        addItemWindow = new javax.swing.JFrame();
        addItemsPanel = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        addItems_sellerField = new javax.swing.JTextField();
        addItems_quantityField = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        addItems_priceField = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        addItems_ItemNameField = new javax.swing.JTextField();
        addItem_codeField = new javax.swing.JTextField();
        addItemsAddButton = new javax.swing.JButton();
        addItemsCancelButton = new javax.swing.JButton();
        addItemsBackButton = new javax.swing.JButton();
        addUser_window = new javax.swing.JFrame();
        addUserPanel = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        addUser_nameField = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        addUser_rePasswordField = new javax.swing.JPasswordField();
        addUser_passwordField = new javax.swing.JPasswordField();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        addUser_roleComboBox = new javax.swing.JComboBox();
        adduser_passwordErrorLabel = new javax.swing.JLabel();
        addUser_cancelButton = new javax.swing.JButton();
        addUser_addButton = new javax.swing.JButton();
        addUser_backButton = new javax.swing.JButton();
        itemSearch_window = new javax.swing.JFrame();
        itemSerach_panel = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        itemSearchTable = new javax.swing.JTable();
        searchByCode_Field = new javax.swing.JTextField();
        searchByName_Field = new javax.swing.JTextField();
        orderItemAdd_window = new javax.swing.JFrame();
        orderItemAdd_Panel = new javax.swing.JPanel();
        orderItem_qtyField = new javax.swing.JTextField();
        jLabel30 = new javax.swing.JLabel();
        orderItem_sellerLabel = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        orderItem_nameLabel = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        orderItem_codeLabel = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        orderItem_qtyLabel = new javax.swing.JLabel();
        orderItem_priceLabel1 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        payWindow = new javax.swing.JFrame();
        payWindowPanel = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        payWindow_cashField = new javax.swing.JTextField();
        payWindow_totalField = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        payWindow_balanceField = new javax.swing.JTextField();
        payWindow_printButton = new javax.swing.JButton();
        payWindow_cancelButton = new javax.swing.JButton();
        nextCutom_MainWindow = new javax.swing.JFrame();
        jPanel1 = new javax.swing.JPanel();
        nextCustomerButton = new javax.swing.JButton();
        mainWindowButton = new javax.swing.JButton();
        jLabel33 = new javax.swing.JLabel();
        exitComformDialog = new javax.swing.JDialog();
        jPanel2 = new javax.swing.JPanel();
        exitDialog_yesButton = new javax.swing.JButton();
        exitDialog_noButton = new javax.swing.JButton();
        exitDialog_cancelButton = new javax.swing.JButton();
        jLabel35 = new javax.swing.JLabel();
        mainwindow_panel = new javax.swing.JPanel();
        mainwindow_stockManagmentButton = new javax.swing.JButton();
        mainwindow_usermanagmentButton = new javax.swing.JButton();
        mainwindow_startButton = new javax.swing.JButton();
        mainwindow_dailyReportButton = new javax.swing.JButton();
        mainwindow_monthlyReportButton = new javax.swing.JButton();
        mainwindow_exitButton = new javax.swing.JButton();
        mainwindow_internalPanel = new javax.swing.JPanel();

        mainwindow_mypanel.setBackground(new java.awt.Color(204, 255, 204));
        mainwindow_mypanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/leafpos_logo.jpg"))); // NOI18N

        javax.swing.GroupLayout mainwindow_mypanelLayout = new javax.swing.GroupLayout(mainwindow_mypanel);
        mainwindow_mypanel.setLayout(mainwindow_mypanelLayout);
        mainwindow_mypanelLayout.setHorizontalGroup(
            mainwindow_mypanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainwindow_mypanelLayout.createSequentialGroup()
                .addGap(115, 115, 115)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 501, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(130, Short.MAX_VALUE))
        );
        mainwindow_mypanelLayout.setVerticalGroup(
            mainwindow_mypanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainwindow_mypanelLayout.createSequentialGroup()
                .addGap(79, 79, 79)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(81, Short.MAX_VALUE))
        );

        stockPanel.setBackground(new java.awt.Color(204, 255, 204));
        stockPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        stockPanel.setFocusTraversalPolicy(new StockPanelFocusTraversalPolicy());

        stockTableScrollPane.setBackground(new java.awt.Color(153, 102, 0));
        stockTableScrollPane.setName("Stock Data"); // NOI18N

        stockTable.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
        stockTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        stockTable.setFocusable(false);
        stockTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        stockTable.getTableHeader().setResizingAllowed(false);
        stockTable.getTableHeader().setReorderingAllowed(false);
        stockTable.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                stockTableFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                stockTableFocusLost(evt);
            }
        });
        stockTableScrollPane.setViewportView(stockTable);

        stock_addButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/edit_add.png"))); // NOI18N
        stock_addButton.setMnemonic('A');
        stock_addButton.setText("Add");
        stock_addButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        stock_addButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stock_addButtonActionPerformed(evt);
            }
        });
        stock_addButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                stock_addButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                stock_addButtonFocusLost(evt);
            }
        });

        stock_backButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/arrow_bottom_left.png"))); // NOI18N
        stock_backButton.setMnemonic('B');
        stock_backButton.setText("Back");
        stock_backButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        stock_backButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        stock_backButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stock_backButtonActionPerformed(evt);
            }
        });
        stock_backButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                stock_backButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                stock_backButtonFocusLost(evt);
            }
        });

        stock_editButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/pencil.png"))); // NOI18N
        stock_editButton.setMnemonic('E');
        stock_editButton.setText("Edit");
        stock_editButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        stock_editButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stock_editButtonActionPerformed(evt);
            }
        });
        stock_editButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                stock_editButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                stock_editButtonFocusLost(evt);
            }
        });

        stock_deleteButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/document_delete.png"))); // NOI18N
        stock_deleteButton.setMnemonic('D');
        stock_deleteButton.setText("Delete");
        stock_deleteButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        stock_deleteButton.setIconTextGap(10);
        stock_deleteButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stock_deleteButtonActionPerformed(evt);
            }
        });
        stock_deleteButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                stock_deleteButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                stock_deleteButtonFocusLost(evt);
            }
        });

        stock_cancelButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/remove.png"))); // NOI18N
        stock_cancelButton.setMnemonic('C');
        stock_cancelButton.setText("Cancel");
        stock_cancelButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        stock_cancelButton.setIconTextGap(10);
        stock_cancelButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                stock_cancelButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                stock_cancelButtonFocusLost(evt);
            }
        });

        jLabel21.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/users.png"))); // NOI18N
        jLabel21.setText("User : ");

        stock_usernameLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        stock_usernameLabel.setText("erfde");
        stock_usernameLabel.setMaximumSize(new java.awt.Dimension(45, 15));
        stock_usernameLabel.setMinimumSize(new java.awt.Dimension(45, 15));

        javax.swing.GroupLayout stockPanelLayout = new javax.swing.GroupLayout(stockPanel);
        stockPanel.setLayout(stockPanelLayout);
        stockPanelLayout.setHorizontalGroup(
            stockPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(stockPanelLayout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(stockPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(stockPanelLayout.createSequentialGroup()
                        .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(stock_usernameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(stockPanelLayout.createSequentialGroup()
                        .addComponent(stockTableScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 589, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addGroup(stockPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(stockPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(stock_cancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(stock_backButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(stock_editButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(stock_deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(stock_addButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );
        stockPanelLayout.setVerticalGroup(
            stockPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, stockPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(stockPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(stock_usernameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(stockPanelLayout.createSequentialGroup()
                        .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(2, 2, 2)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(stockPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(stockPanelLayout.createSequentialGroup()
                        .addComponent(stock_addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(38, 38, 38)
                        .addComponent(stock_editButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(stock_deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(stock_cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(stock_backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(stockTableScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(21, 21, Short.MAX_VALUE))
        );

        dailyReportPanel.setBackground(new java.awt.Color(204, 255, 204));
        dailyReportPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jScrollPane2.setBackground(new java.awt.Color(153, 102, 0));
        jScrollPane2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        dailyReport_table.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        dailyReport_table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        dailyReport_table.setFocusable(false);
        jScrollPane2.setViewportView(dailyReport_table);

        dailyReport_showReportButton.setMnemonic('S');
        dailyReport_showReportButton.setText("Show Report");
        dailyReport_showReportButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        dailyReport_showReportButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dailyReport_showReportButtonActionPerformed(evt);
            }
        });
        dailyReport_showReportButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                dailyReport_showReportButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                dailyReport_showReportButtonFocusLost(evt);
            }
        });

        dailyReports_backButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/arrow_bottom_left.png"))); // NOI18N
        dailyReports_backButton.setMnemonic('B');
        dailyReports_backButton.setText("Back");
        dailyReports_backButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        dailyReports_backButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        dailyReports_backButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dailyReports_backButtonActionPerformed(evt);
            }
        });
        dailyReports_backButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                dailyReports_backButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                dailyReports_backButtonFocusLost(evt);
            }
        });

        dailyReport_yearCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025" }));

        dailyReport_monthCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "April", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec" }));
        dailyReport_monthCombo.setSelectedIndex(10);

        dailyReport_dayCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        dailyReport_dayCombo.setSelectedIndex(28);

        jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel20.setText("/");

        jLabel32.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel32.setText("/");

        javax.swing.GroupLayout dailyReportPanelLayout = new javax.swing.GroupLayout(dailyReportPanel);
        dailyReportPanel.setLayout(dailyReportPanelLayout);
        dailyReportPanelLayout.setHorizontalGroup(
            dailyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dailyReportPanelLayout.createSequentialGroup()
                .addGroup(dailyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(dailyReportPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(dailyReport_yearCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(3, 3, 3)
                        .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(2, 2, 2)
                        .addComponent(dailyReport_monthCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(3, 3, 3)
                        .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(2, 2, 2)
                        .addComponent(dailyReport_dayCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(dailyReportPanelLayout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 607, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(dailyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(dailyReports_backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(dailyReport_showReportButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        dailyReportPanelLayout.setVerticalGroup(
            dailyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dailyReportPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(dailyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(dailyReport_yearCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dailyReport_monthCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dailyReport_dayCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20)
                    .addComponent(jLabel32))
                .addGap(13, 13, 13)
                .addGroup(dailyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(dailyReportPanelLayout.createSequentialGroup()
                        .addComponent(dailyReport_showReportButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(dailyReports_backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 367, Short.MAX_VALUE))
                .addGap(27, 27, 27))
        );

        monthlyReportPanel.setBackground(new java.awt.Color(204, 255, 204));
        monthlyReportPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jScrollPane4.setBackground(new java.awt.Color(153, 102, 0));

        monthlyReport_table.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        monthlyReport_table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        monthlyReport_table.setFocusable(false);
        jScrollPane4.setViewportView(monthlyReport_table);

        monthlyReport_showReportButton.setMnemonic('S');
        monthlyReport_showReportButton.setText("Show Reports");
        monthlyReport_showReportButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        monthlyReport_showReportButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                monthlyReport_showReportButtonActionPerformed(evt);
            }
        });
        monthlyReport_showReportButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                monthlyReport_showReportButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                monthlyReport_showReportButtonFocusLost(evt);
            }
        });

        monthlyReports_backButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/arrow_bottom_left.png"))); // NOI18N
        monthlyReports_backButton.setMnemonic('B');
        monthlyReports_backButton.setText("Back");
        monthlyReports_backButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        monthlyReports_backButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        monthlyReports_backButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                monthlyReports_backButtonActionPerformed(evt);
            }
        });
        monthlyReports_backButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                monthlyReports_backButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                monthlyReports_backButtonFocusLost(evt);
            }
        });

        monthlyReport_monthCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "April", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec" }));
        monthlyReport_monthCombo.setSelectedIndex(10);

        monthlyReport_yearCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025" }));
        monthlyReport_yearCombo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                monthlyReport_yearComboActionPerformed(evt);
            }
        });

        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel9.setText("/");

        javax.swing.GroupLayout monthlyReportPanelLayout = new javax.swing.GroupLayout(monthlyReportPanel);
        monthlyReportPanel.setLayout(monthlyReportPanelLayout);
        monthlyReportPanelLayout.setHorizontalGroup(
            monthlyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(monthlyReportPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(monthlyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(monthlyReportPanelLayout.createSequentialGroup()
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(monthlyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(monthlyReports_backButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(monthlyReport_showReportButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(monthlyReportPanelLayout.createSequentialGroup()
                        .addComponent(monthlyReport_yearCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(2, 2, 2)
                        .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(3, 3, 3)
                        .addComponent(monthlyReport_monthCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        monthlyReportPanelLayout.setVerticalGroup(
            monthlyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, monthlyReportPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(monthlyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(monthlyReport_yearCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(monthlyReport_monthCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(monthlyReportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(monthlyReportPanelLayout.createSequentialGroup()
                        .addGap(0, 28, Short.MAX_VALUE)
                        .addComponent(monthlyReport_showReportButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(283, 283, 283)
                        .addComponent(monthlyReports_backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap())
        );

        usermanagementPanel.setBackground(new java.awt.Color(204, 255, 204));
        usermanagementPanel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        usermanagementPanel.setFocusTraversalPolicy(new UsermanagmentFocusTraversalPolicy());

        userManagement_addUserButton.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        userManagement_addUserButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/users_add.png"))); // NOI18N
        userManagement_addUserButton.setMnemonic('A');
        userManagement_addUserButton.setText("Add ");
        userManagement_addUserButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        userManagement_addUserButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                userManagement_addUserButtonActionPerformed(evt);
            }
        });
        userManagement_addUserButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                userManagement_addUserButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                userManagement_addUserButtonFocusLost(evt);
            }
        });

        userManagement_editUserButton.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        userManagement_editUserButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/users_edit.png"))); // NOI18N
        userManagement_editUserButton.setMnemonic('E');
        userManagement_editUserButton.setText("Edit");
        userManagement_editUserButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        userManagement_editUserButton.setEnabled(false);
        userManagement_editUserButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                userManagement_editUserButtonActionPerformed(evt);
            }
        });
        userManagement_editUserButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                userManagement_editUserButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                userManagement_editUserButtonFocusLost(evt);
            }
        });

        userManagement_deleteUserButton.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        userManagement_deleteUserButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/user_delete.png"))); // NOI18N
        userManagement_deleteUserButton.setMnemonic('D');
        userManagement_deleteUserButton.setText("Delete");
        userManagement_deleteUserButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        userManagement_deleteUserButton.setIconTextGap(10);
        userManagement_deleteUserButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                userManagement_deleteUserButtonActionPerformed(evt);
            }
        });
        userManagement_deleteUserButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                userManagement_deleteUserButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                userManagement_deleteUserButtonFocusLost(evt);
            }
        });

        userManagement_BackButton.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        userManagement_BackButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/arrow_bottom_left.png"))); // NOI18N
        userManagement_BackButton.setMnemonic('B');
        userManagement_BackButton.setText("Back");
        userManagement_BackButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        userManagement_BackButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                userManagement_BackButtonActionPerformed(evt);
            }
        });
        userManagement_BackButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                userManagement_BackButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                userManagement_BackButtonFocusLost(evt);
            }
        });

        userTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        userTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(userTable);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/user_view.png"))); // NOI18N
        jLabel2.setText("Users");
        jLabel2.setIconTextGap(20);

        javax.swing.GroupLayout usermanagementPanelLayout = new javax.swing.GroupLayout(usermanagementPanel);
        usermanagementPanel.setLayout(usermanagementPanelLayout);
        usermanagementPanelLayout.setHorizontalGroup(
            usermanagementPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(usermanagementPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(usermanagementPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(usermanagementPanelLayout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(usermanagementPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(userManagement_deleteUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(usermanagementPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(userManagement_editUserButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(userManagement_addUserButton, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE))
                            .addComponent(userManagement_BackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        usermanagementPanelLayout.setVerticalGroup(
            usermanagementPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(usermanagementPanelLayout.createSequentialGroup()
                .addGroup(usermanagementPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(usermanagementPanelLayout.createSequentialGroup()
                        .addGap(74, 74, 74)
                        .addComponent(userManagement_addUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(32, 32, 32)
                        .addComponent(userManagement_editUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31)
                        .addComponent(userManagement_deleteUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 104, Short.MAX_VALUE)
                        .addComponent(userManagement_BackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(usermanagementPanelLayout.createSequentialGroup()
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );

        orderPanel.setBackground(new java.awt.Color(204, 255, 204));
        orderPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        orderPanel.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                orderPanelFocusGained(evt);
            }
        });

        order_removeButton.setMnemonic('R');
        order_removeButton.setText("Remove");
        order_removeButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        order_removeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                order_removeButtonActionPerformed(evt);
            }
        });
        order_removeButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                order_removeButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                order_removeButtonFocusLost(evt);
            }
        });

        order_cancelButton.setMnemonic('C');
        order_cancelButton.setText("Cancel");
        order_cancelButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        order_cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                order_cancelButtonActionPerformed(evt);
            }
        });
        order_cancelButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                order_cancelButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                order_cancelButtonFocusLost(evt);
            }
        });

        orderTable.setFocusable(false);
        orderTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane3.setViewportView(orderTable);

        order_addButton.setMnemonic('A');
        order_addButton.setText("Add");
        order_addButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        order_addButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                order_addButtonActionPerformed(evt);
            }
        });
        order_addButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                order_addButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                order_addButtonFocusLost(evt);
            }
        });

        order_backButton.setMnemonic('B');
        order_backButton.setText("<< Back");
        order_backButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        order_backButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                order_backButtonActionPerformed(evt);
            }
        });
        order_backButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                order_backButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                order_backButtonFocusLost(evt);
            }
        });

        order_payButton.setMnemonic('P');
        order_payButton.setText("Pay");
        order_payButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        order_payButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                order_payButtonActionPerformed(evt);
            }
        });
        order_payButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                order_payButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                order_payButtonFocusLost(evt);
            }
        });

        jLabel19.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel19.setText("Total :");
        jLabel19.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        order_totalLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        order_totalLabel.setText("0.00");
        order_totalLabel.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        order_usernameLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        order_usernameLabel.setText("User");
        order_usernameLabel.setMaximumSize(new java.awt.Dimension(45, 15));
        order_usernameLabel.setMinimumSize(new java.awt.Dimension(45, 15));

        jLabel24.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        jLabel24.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/users.png"))); // NOI18N
        jLabel24.setText("User : ");

        order_invoiceLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        order_invoiceLabel.setText("000000");
        order_invoiceLabel.setMaximumSize(new java.awt.Dimension(45, 15));
        order_invoiceLabel.setMinimumSize(new java.awt.Dimension(45, 15));

        jLabel34.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel34.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel34.setText("Invoice :");

        javax.swing.GroupLayout orderPanelLayout = new javax.swing.GroupLayout(orderPanel);
        orderPanel.setLayout(orderPanelLayout);
        orderPanelLayout.setHorizontalGroup(
            orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(orderPanelLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(order_usernameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(142, 142, 142)
                .addComponent(jLabel34, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(order_invoiceLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(24, Short.MAX_VALUE))
            .addGroup(orderPanelLayout.createSequentialGroup()
                .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(orderPanelLayout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jScrollPane3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, orderPanelLayout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(order_totalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(44, 44, 44)))
                .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(order_payButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(order_addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(order_removeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(order_cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(order_backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(15, 15, 15))
        );
        orderPanelLayout.setVerticalGroup(
            orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(orderPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(orderPanelLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(order_invoiceLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel34)))
                    .addGroup(orderPanelLayout.createSequentialGroup()
                        .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel24, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(order_usernameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(4, 4, 4)))
                .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(orderPanelLayout.createSequentialGroup()
                        .addComponent(order_payButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(order_addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(order_removeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(97, 97, 97)
                        .addComponent(order_cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(order_backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(order_totalLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        editItemWindow.setResizable(false);

        editItemPanel.setBackground(new java.awt.Color(204, 255, 204));
        editItemPanel.setPreferredSize(new java.awt.Dimension(Constants.AED_WINDOW_WIDTH , Constants.AED_WINDOW_HEIGHT));

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel8.setText("Code :  ");

        jLabel22.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel22.setText("Item Name :");

        jLabel23.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel23.setText("Seller : ");

        editItem_sellerField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        editItem_sellerField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editItem_sellerFieldActionPerformed(evt);
            }
        });

        editItem_quantityField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        editItem_quantityField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editItem_quantityFieldActionPerformed(evt);
            }
        });

        jLabel25.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel25.setText("Quantity :");

        editItem_priceField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        jLabel26.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel26.setText("Price :");

        editItem_ItemNameField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        editItem_codeField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        editItems_okButton.setMnemonic('O');
        editItems_okButton.setText("Ok");
        editItems_okButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        editItems_okButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editItems_okButtonActionPerformed(evt);
            }
        });

        editItems_backButton.setMnemonic('B');
        editItems_backButton.setText("<< Back");
        editItems_backButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        editItems_backButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editItems_backButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout editItemPanelLayout = new javax.swing.GroupLayout(editItemPanel);
        editItemPanel.setLayout(editItemPanelLayout);
        editItemPanelLayout.setHorizontalGroup(
            editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(editItemPanelLayout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editItemPanelLayout.createSequentialGroup()
                        .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(editItemPanelLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(editItem_codeField, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editItemPanelLayout.createSequentialGroup()
                                .addGap(4, 4, 4)
                                .addComponent(editItem_ItemNameField, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(editItemPanelLayout.createSequentialGroup()
                            .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jLabel26, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel25, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE))
                            .addGap(32, 32, 32)
                            .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(editItem_quantityField)
                                .addComponent(editItem_priceField)))
                        .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(editItemPanelLayout.createSequentialGroup()
                            .addGap(112, 112, 112)
                            .addComponent(editItem_sellerField, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(editItems_okButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(editItems_backButton, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE))
                .addGap(19, 19, 19))
        );
        editItemPanelLayout.setVerticalGroup(
            editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editItemPanelLayout.createSequentialGroup()
                .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(editItemPanelLayout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(editItem_codeField, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(editItemPanelLayout.createSequentialGroup()
                                .addGap(1, 1, 1)
                                .addComponent(jLabel22, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE))
                            .addComponent(editItem_ItemNameField, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(editItem_sellerField, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(editItem_quantityField, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 62, Short.MAX_VALUE))
                    .addGroup(editItemPanelLayout.createSequentialGroup()
                        .addGap(49, 49, 49)
                        .addComponent(editItems_okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(editItemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(editItem_priceField, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(editItems_backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        javax.swing.GroupLayout editItemWindowLayout = new javax.swing.GroupLayout(editItemWindow.getContentPane());
        editItemWindow.getContentPane().setLayout(editItemWindowLayout);
        editItemWindowLayout.setHorizontalGroup(
            editItemWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 495, Short.MAX_VALUE)
            .addGroup(editItemWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(editItemPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE))
        );
        editItemWindowLayout.setVerticalGroup(
            editItemWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 256, Short.MAX_VALUE)
            .addGroup(editItemWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(editItemPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))
        );

        addItemWindow.setFocusTraversalPolicy(new StockAddItemFocusTraversalPolicy());
        addItemWindow.setResizable(false);

        addItemsPanel.setBackground(new java.awt.Color(204, 255, 204));

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel3.setText("Code :  ");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel4.setText("Item Name :");

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel10.setText("Seller : ");

        addItems_sellerField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        addItems_quantityField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        addItems_quantityField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addItems_quantityFieldActionPerformed(evt);
            }
        });

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel11.setText("Quantity :");

        addItems_priceField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        addItems_priceField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addItems_priceFieldActionPerformed(evt);
            }
        });

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel12.setText("Price :");

        addItems_ItemNameField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        addItem_codeField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        addItemsAddButton.setMnemonic('A');
        addItemsAddButton.setText("Add");
        addItemsAddButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        addItemsAddButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addItemsAddButtonActionPerformed(evt);
            }
        });

        addItemsCancelButton.setMnemonic('C');
        addItemsCancelButton.setText("Cancel");
        addItemsCancelButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        addItemsCancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addItemsCancelButtonActionPerformed(evt);
            }
        });

        addItemsBackButton.setMnemonic('B');
        addItemsBackButton.setText("<< Back");
        addItemsBackButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        addItemsBackButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addItemsBackButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout addItemsPanelLayout = new javax.swing.GroupLayout(addItemsPanel);
        addItemsPanel.setLayout(addItemsPanelLayout);
        addItemsPanelLayout.setHorizontalGroup(
            addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addItemsPanelLayout.createSequentialGroup()
                .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addItemsPanelLayout.createSequentialGroup()
                        .addGap(44, 44, 44)
                        .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(addItemsPanelLayout.createSequentialGroup()
                                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(addItem_codeField, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE))
                            .addGroup(addItemsPanelLayout.createSequentialGroup()
                                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(addItems_ItemNameField, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE))))
                    .addGroup(addItemsPanelLayout.createSequentialGroup()
                        .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(addItemsPanelLayout.createSequentialGroup()
                                .addGap(44, 44, 44)
                                .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(addItemsPanelLayout.createSequentialGroup()
                                .addGap(40, 40, 40)
                                .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(addItems_sellerField, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
                            .addComponent(addItems_quantityField, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
                            .addComponent(addItems_priceField, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE))))
                .addGap(51, 51, 51)
                .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(addItemsCancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(addItemsAddButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(addItemsBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(32, 32, 32))
        );
        addItemsPanelLayout.setVerticalGroup(
            addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addItemsPanelLayout.createSequentialGroup()
                .addGap(52, 52, 52)
                .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addItemsPanelLayout.createSequentialGroup()
                        .addComponent(addItemsAddButton, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(58, 58, 58)
                        .addComponent(addItemsCancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(38, 38, 38)
                        .addComponent(addItemsBackButton, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 1, Short.MAX_VALUE))
                    .addGroup(addItemsPanelLayout.createSequentialGroup()
                        .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(addItemsPanelLayout.createSequentialGroup()
                                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(addItems_ItemNameField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(addItems_sellerField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(addItemsPanelLayout.createSequentialGroup()
                                .addGap(2, 2, 2)
                                .addComponent(addItem_codeField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(addItems_quantityField))
                        .addGap(18, 18, 18)
                        .addGroup(addItemsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(addItems_priceField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        javax.swing.GroupLayout addItemWindowLayout = new javax.swing.GroupLayout(addItemWindow.getContentPane());
        addItemWindow.getContentPane().setLayout(addItemWindowLayout);
        addItemWindowLayout.setHorizontalGroup(
            addItemWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(addItemsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        addItemWindowLayout.setVerticalGroup(
            addItemWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(addItemsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        addUser_window.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        addUser_window.setTitle("Add User");
        addUser_window.setFocusTraversalPolicy(new AdduserFocusTravel());
        addUser_window.setName("Add User"); // NOI18N
        addUser_window.setResizable(false);
        addUser_window.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                addUser_windowWindowClosing(evt);
            }
        });

        addUserPanel.setBackground(new java.awt.Color(204, 255, 204));

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel13.setText("Re-Password :");

        addUser_nameField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel14.setText("Role :");

        addUser_rePasswordField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        addUser_passwordField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel15.setText("Password :");

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel16.setText("Name :");

        addUser_roleComboBox.setBackground(new java.awt.Color(102, 102, 0));
        addUser_roleComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Employee", "Manager", "Administrator", "User" }));

        adduser_passwordErrorLabel.setFont(new java.awt.Font("Tahoma", 0, 8)); // NOI18N
        adduser_passwordErrorLabel.setForeground(new java.awt.Color(255, 0, 0));
        adduser_passwordErrorLabel.setPreferredSize(new java.awt.Dimension(100, 15));

        addUser_cancelButton.setMnemonic('C');
        addUser_cancelButton.setText("Cancel");
        addUser_cancelButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        addUser_cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addUser_cancelButtonActionPerformed(evt);
            }
        });

        addUser_addButton.setMnemonic('A');
        addUser_addButton.setText("Add");
        addUser_addButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        addUser_addButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addUser_addButtonActionPerformed(evt);
            }
        });

        addUser_backButton.setMnemonic('B');
        addUser_backButton.setText("<< Back");
        addUser_backButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        addUser_backButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addUser_backButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout addUserPanelLayout = new javax.swing.GroupLayout(addUserPanel);
        addUserPanel.setLayout(addUserPanelLayout);
        addUserPanelLayout.setHorizontalGroup(
            addUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addUserPanelLayout.createSequentialGroup()
                .addGap(58, 58, 58)
                .addGroup(addUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addUserPanelLayout.createSequentialGroup()
                        .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(addUser_nameField, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addUserPanelLayout.createSequentialGroup()
                        .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(addUser_passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addUserPanelLayout.createSequentialGroup()
                        .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(addUser_rePasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(addUserPanelLayout.createSequentialGroup()
                        .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(addUser_roleComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(addUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addUserPanelLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(addUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(addUser_cancelButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(addUser_backButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(addUserPanelLayout.createSequentialGroup()
                        .addGap(78, 78, 78)
                        .addComponent(addUser_addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(473, 473, 473)
                .addComponent(adduser_passwordErrorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        addUserPanelLayout.setVerticalGroup(
            addUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addUserPanelLayout.createSequentialGroup()
                .addGap(57, 57, 57)
                .addComponent(adduser_passwordErrorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(addUserPanelLayout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(addUser_addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(addUser_cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(52, 52, 52)
                .addComponent(addUser_backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(addUserPanelLayout.createSequentialGroup()
                .addGap(54, 54, 54)
                .addGroup(addUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(addUser_nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(13, 13, 13)
                .addGroup(addUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(addUser_passwordField))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(addUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(addUser_rePasswordField))
                .addGap(18, 18, 18)
                .addGroup(addUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(addUser_roleComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout addUser_windowLayout = new javax.swing.GroupLayout(addUser_window.getContentPane());
        addUser_window.getContentPane().setLayout(addUser_windowLayout);
        addUser_windowLayout.setHorizontalGroup(
            addUser_windowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(addUserPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
        );
        addUser_windowLayout.setVerticalGroup(
            addUser_windowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(addUserPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        itemSearch_window.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        itemSearch_window.setTitle("Search Items");
        itemSearch_window.setFocusTraversalPolicy(new ItemSearchFocusTravel());
        itemSearch_window.setName("Search Items"); // NOI18N
        itemSearch_window.setResizable(false);
        itemSearch_window.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                itemSearch_windowWindowClosing(evt);
            }
        });

        itemSerach_panel.setBackground(new java.awt.Color(204, 255, 204));

        jLabel17.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel17.setText("Search by Code : ");

        jLabel18.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel18.setText("Search by Name :");

        itemSearchTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        itemSearchTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane5.setViewportView(itemSearchTable);

        searchByCode_Field.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                searchByCode_FieldFocusGained(evt);
            }
        });

        searchByName_Field.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                searchByName_FieldFocusGained(evt);
            }
        });

        javax.swing.GroupLayout itemSerach_panelLayout = new javax.swing.GroupLayout(itemSerach_panel);
        itemSerach_panel.setLayout(itemSerach_panelLayout);
        itemSerach_panelLayout.setHorizontalGroup(
            itemSerach_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(itemSerach_panelLayout.createSequentialGroup()
                .addGap(32, 32, 32)
                .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(searchByName_Field, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel17)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(searchByCode_Field, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(60, 60, 60))
            .addGroup(itemSerach_panelLayout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 643, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(34, Short.MAX_VALUE))
        );
        itemSerach_panelLayout.setVerticalGroup(
            itemSerach_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(itemSerach_panelLayout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(itemSerach_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(searchByCode_Field, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18)
                    .addComponent(searchByName_Field, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 377, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(32, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout itemSearch_windowLayout = new javax.swing.GroupLayout(itemSearch_window.getContentPane());
        itemSearch_window.getContentPane().setLayout(itemSearch_windowLayout);
        itemSearch_windowLayout.setHorizontalGroup(
            itemSearch_windowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(itemSerach_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        itemSearch_windowLayout.setVerticalGroup(
            itemSearch_windowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(itemSerach_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        orderItemAdd_window.setResizable(false);

        orderItemAdd_Panel.setBackground(new java.awt.Color(204, 255, 204));

        orderItem_qtyField.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

        jLabel30.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel30.setText("Qty :");

        orderItem_sellerLabel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

        jLabel29.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel29.setText("Seller :");

        orderItem_nameLabel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

        jLabel28.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel28.setText("Name :");

        orderItem_codeLabel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

        jLabel27.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel27.setText("Code :");

        orderItem_qtyLabel.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        orderItem_qtyLabel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        orderItem_priceLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

        jLabel31.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel31.setText("Price :");

        jLabel36.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel36.setText("/");

        javax.swing.GroupLayout orderItemAdd_PanelLayout = new javax.swing.GroupLayout(orderItemAdd_Panel);
        orderItemAdd_Panel.setLayout(orderItemAdd_PanelLayout);
        orderItemAdd_PanelLayout.setHorizontalGroup(
            orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(orderItemAdd_PanelLayout.createSequentialGroup()
                .addGap(66, 66, 66)
                .addGroup(orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(orderItemAdd_PanelLayout.createSequentialGroup()
                        .addComponent(jLabel27)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(orderItem_codeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(orderItemAdd_PanelLayout.createSequentialGroup()
                            .addComponent(jLabel28)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(orderItem_nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(orderItemAdd_PanelLayout.createSequentialGroup()
                                .addComponent(jLabel31)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(orderItem_priceLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(orderItemAdd_PanelLayout.createSequentialGroup()
                                .addComponent(jLabel29)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(orderItem_sellerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(orderItemAdd_PanelLayout.createSequentialGroup()
                                .addComponent(jLabel30)
                                .addGap(18, 18, 18)
                                .addComponent(orderItem_qtyField, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, 5, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(orderItem_qtyLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(118, Short.MAX_VALUE))
        );
        orderItemAdd_PanelLayout.setVerticalGroup(
            orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(orderItemAdd_PanelLayout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel27)
                    .addComponent(orderItem_codeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel28)
                    .addComponent(orderItem_nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel29)
                    .addComponent(orderItem_sellerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel31)
                    .addComponent(orderItem_priceLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(orderItemAdd_PanelLayout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLabel30))
                    .addGroup(orderItemAdd_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(orderItem_qtyField, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel36))
                    .addComponent(orderItem_qtyLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(67, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout orderItemAdd_windowLayout = new javax.swing.GroupLayout(orderItemAdd_window.getContentPane());
        orderItemAdd_window.getContentPane().setLayout(orderItemAdd_windowLayout);
        orderItemAdd_windowLayout.setHorizontalGroup(
            orderItemAdd_windowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(orderItemAdd_Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        orderItemAdd_windowLayout.setVerticalGroup(
            orderItemAdd_windowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(orderItemAdd_Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        payWindow.setResizable(false);

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel5.setText("Cash :");

        payWindow_cashField.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        payWindow_cashField.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                payWindow_cashFieldFocusLost(evt);
            }
        });

        payWindow_totalField.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        payWindow_totalField.setEnabled(false);

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel6.setText("Total :");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel7.setText("Balance :");

        payWindow_balanceField.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        payWindow_balanceField.setEnabled(false);

        payWindow_printButton.setMnemonic('P');
        payWindow_printButton.setText("Print");
        payWindow_printButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        payWindow_printButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                payWindow_printButtonActionPerformed(evt);
            }
        });

        payWindow_cancelButton.setMnemonic('C');
        payWindow_cancelButton.setText("Cancel");
        payWindow_cancelButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        payWindow_cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                payWindow_cancelButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout payWindowPanelLayout = new javax.swing.GroupLayout(payWindowPanel);
        payWindowPanel.setLayout(payWindowPanelLayout);
        payWindowPanelLayout.setHorizontalGroup(
            payWindowPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(payWindowPanelLayout.createSequentialGroup()
                .addGroup(payWindowPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(payWindowPanelLayout.createSequentialGroup()
                        .addGap(23, 23, 23)
                        .addGroup(payWindowPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(payWindowPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(payWindow_cashField)
                            .addComponent(payWindow_totalField)
                            .addComponent(payWindow_balanceField, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(payWindowPanelLayout.createSequentialGroup()
                        .addGap(58, 58, 58)
                        .addComponent(payWindow_printButton, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(33, 33, 33)
                        .addComponent(payWindow_cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(55, Short.MAX_VALUE))
        );
        payWindowPanelLayout.setVerticalGroup(
            payWindowPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(payWindowPanelLayout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addGroup(payWindowPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(payWindow_cashField, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(39, 39, 39)
                .addGroup(payWindowPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(payWindow_totalField, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(39, 39, 39)
                .addGroup(payWindowPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(payWindow_balanceField, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(36, 36, 36)
                .addGroup(payWindowPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(payWindow_printButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(payWindow_cancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE))
                .addGap(20, 20, 20))
        );

        javax.swing.GroupLayout payWindowLayout = new javax.swing.GroupLayout(payWindow.getContentPane());
        payWindow.getContentPane().setLayout(payWindowLayout);
        payWindowLayout.setHorizontalGroup(
            payWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(payWindowPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        payWindowLayout.setVerticalGroup(
            payWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(payWindowPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        nextCutom_MainWindow.setResizable(false);

        nextCustomerButton.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        nextCustomerButton.setMnemonic('N');
        nextCustomerButton.setText("Next Customer");
        nextCustomerButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        nextCustomerButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nextCustomerButtonActionPerformed(evt);
            }
        });

        mainWindowButton.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        mainWindowButton.setMnemonic('M');
        mainWindowButton.setText("Main Window");
        mainWindowButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        mainWindowButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mainWindowButtonActionPerformed(evt);
            }
        });

        jLabel33.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel33.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel33.setText("Successfully execute order, What do you need to go?");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(33, 33, 33)
                        .addComponent(mainWindowButton, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(28, 28, 28)
                        .addComponent(nextCustomerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 393, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(27, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel33, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nextCustomerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mainWindowButton, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26))
        );

        javax.swing.GroupLayout nextCutom_MainWindowLayout = new javax.swing.GroupLayout(nextCutom_MainWindow.getContentPane());
        nextCutom_MainWindow.getContentPane().setLayout(nextCutom_MainWindowLayout);
        nextCutom_MainWindowLayout.setHorizontalGroup(
            nextCutom_MainWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        nextCutom_MainWindowLayout.setVerticalGroup(
            nextCutom_MainWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        exitComformDialog.setResizable(false);

        jPanel2.setPreferredSize(new java.awt.Dimension(350, 150));

        exitDialog_yesButton.setMnemonic('Y');
        exitDialog_yesButton.setText("Yes");
        exitDialog_yesButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitDialog_yesButtonActionPerformed(evt);
            }
        });

        exitDialog_noButton.setMnemonic('N');
        exitDialog_noButton.setText("No");
        exitDialog_noButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitDialog_noButtonActionPerformed(evt);
            }
        });

        exitDialog_cancelButton.setMnemonic('C');
        exitDialog_cancelButton.setText("Cancel");
        exitDialog_cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitDialog_cancelButtonActionPerformed(evt);
            }
        });

        jLabel35.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel35.setText("Do you realy want to exit (logout)  ?");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel35, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(108, 108, 108)
                .addComponent(exitDialog_yesButton)
                .addGap(18, 18, 18)
                .addComponent(exitDialog_noButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(exitDialog_cancelButton)
                .addContainerGap(57, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel35, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(exitDialog_yesButton)
                    .addComponent(exitDialog_noButton)
                    .addComponent(exitDialog_cancelButton))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout exitComformDialogLayout = new javax.swing.GroupLayout(exitComformDialog.getContentPane());
        exitComformDialog.getContentPane().setLayout(exitComformDialogLayout);
        exitComformDialogLayout.setHorizontalGroup(
            exitComformDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(exitComformDialogLayout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(73, Short.MAX_VALUE))
        );
        exitComformDialogLayout.setVerticalGroup(
            exitComformDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(exitComformDialogLayout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(43, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        mainwindow_panel.setBackground(new java.awt.Color(187, 187, 105));
        mainwindow_panel.setFocusTraversalPolicy(new MainPanelFocusTraversalPolicy());
        mainwindow_panel.setPreferredSize(new java.awt.Dimension(80, 494));

        mainwindow_stockManagmentButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        mainwindow_stockManagmentButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stats.png"))); // NOI18N
        mainwindow_stockManagmentButton.setMnemonic('T');
        mainwindow_stockManagmentButton.setText("Stock Managment");
        mainwindow_stockManagmentButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        mainwindow_stockManagmentButton.setIconTextGap(10);
        mainwindow_stockManagmentButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mainwindow_stockManagmentButtonActionPerformed(evt);
            }
        });
        mainwindow_stockManagmentButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                mainwindow_stockManagmentButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                mainwindow_stockManagmentButtonFocusLost(evt);
            }
        });

        mainwindow_usermanagmentButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        mainwindow_usermanagmentButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/user_group.png"))); // NOI18N
        mainwindow_usermanagmentButton.setMnemonic('U');
        mainwindow_usermanagmentButton.setText("User Managment");
        mainwindow_usermanagmentButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        mainwindow_usermanagmentButton.setIconTextGap(10);
        mainwindow_usermanagmentButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mainwindow_usermanagmentButtonActionPerformed(evt);
            }
        });
        mainwindow_usermanagmentButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                mainwindow_usermanagmentButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                mainwindow_usermanagmentButtonFocusLost(evt);
            }
        });

        mainwindow_startButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        mainwindow_startButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/next-sail.png"))); // NOI18N
        mainwindow_startButton.setMnemonic('S');
        mainwindow_startButton.setText("Start Sale");
        mainwindow_startButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        mainwindow_startButton.setIconTextGap(10);
        mainwindow_startButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mainwindow_startButtonActionPerformed(evt);
            }
        });
        mainwindow_startButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                mainwindow_startButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                mainwindow_startButtonFocusLost(evt);
            }
        });

        mainwindow_dailyReportButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        mainwindow_dailyReportButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stat.png"))); // NOI18N
        mainwindow_dailyReportButton.setMnemonic('D');
        mainwindow_dailyReportButton.setText("Daily Reports");
        mainwindow_dailyReportButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        mainwindow_dailyReportButton.setIconTextGap(10);
        mainwindow_dailyReportButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mainwindow_dailyReportButtonActionPerformed(evt);
            }
        });
        mainwindow_dailyReportButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                mainwindow_dailyReportButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                mainwindow_dailyReportButtonFocusLost(evt);
            }
        });

        mainwindow_monthlyReportButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        mainwindow_monthlyReportButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/my_documents.png"))); // NOI18N
        mainwindow_monthlyReportButton.setMnemonic('M');
        mainwindow_monthlyReportButton.setText("Monthly Reports");
        mainwindow_monthlyReportButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        mainwindow_monthlyReportButton.setIconTextGap(10);
        mainwindow_monthlyReportButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mainwindow_monthlyReportButtonActionPerformed(evt);
            }
        });
        mainwindow_monthlyReportButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                mainwindow_monthlyReportButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                mainwindow_monthlyReportButtonFocusLost(evt);
            }
        });

        mainwindow_exitButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        mainwindow_exitButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/button_cancel.png"))); // NOI18N
        mainwindow_exitButton.setMnemonic('E');
        mainwindow_exitButton.setText("Exit");
        mainwindow_exitButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        mainwindow_exitButton.setIconTextGap(15);
        mainwindow_exitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mainwindow_exitButtonActionPerformed(evt);
            }
        });
        mainwindow_exitButton.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                mainwindow_exitButtonFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                mainwindow_exitButtonFocusLost(evt);
            }
        });

        mainwindow_internalPanel.setPreferredSize(new java.awt.Dimension(750, 400));

        javax.swing.GroupLayout mainwindow_internalPanelLayout = new javax.swing.GroupLayout(mainwindow_internalPanel);
        mainwindow_internalPanel.setLayout(mainwindow_internalPanelLayout);
        mainwindow_internalPanelLayout.setHorizontalGroup(
            mainwindow_internalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 750, Short.MAX_VALUE)
        );
        mainwindow_internalPanelLayout.setVerticalGroup(
            mainwindow_internalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 405, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout mainwindow_panelLayout = new javax.swing.GroupLayout(mainwindow_panel);
        mainwindow_panel.setLayout(mainwindow_panelLayout);
        mainwindow_panelLayout.setHorizontalGroup(
            mainwindow_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainwindow_panelLayout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(mainwindow_internalPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainwindow_panelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(mainwindow_stockManagmentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(36, 36, 36)
                .addComponent(mainwindow_usermanagmentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(37, 37, 37)
                .addComponent(mainwindow_startButton, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(117, 117, 117))
            .addGroup(mainwindow_panelLayout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addComponent(mainwindow_dailyReportButton, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(45, 45, 45)
                .addComponent(mainwindow_monthlyReportButton, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(mainwindow_exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(63, 63, 63))
        );
        mainwindow_panelLayout.setVerticalGroup(
            mainwindow_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainwindow_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainwindow_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mainwindow_stockManagmentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mainwindow_usermanagmentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mainwindow_startButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(mainwindow_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(mainwindow_exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(mainwindow_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(mainwindow_dailyReportButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(mainwindow_monthlyReportButton, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(mainwindow_internalPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainwindow_panel, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mainwindow_panel, javax.swing.GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void stockTableFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stockTableFocusGained
        stockTable.getSelectionModel().setSelectionInterval(0, 0);
    }//GEN-LAST:event_stockTableFocusGained

    private void stockTableFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stockTableFocusLost
        //        stockTable.getSelectionModel().clearSelection();
    }//GEN-LAST:event_stockTableFocusLost

    private void stock_addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stock_addButtonActionPerformed
        addItemWindow.setLocationRelativeTo(addItemWindow);
        addItemWindow.setVisible(true);
    }//GEN-LAST:event_stock_addButtonActionPerformed

    private void stock_backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stock_backButtonActionPerformed
        actionChange(Action.STOCK_WINDOW_BACK);
    }//GEN-LAST:event_stock_backButtonActionPerformed

    private void stock_editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stock_editButtonActionPerformed
        int selRow = stockTable.getSelectedRow();
        if (selRow == -1) {
            GuiUtil.showInfoMessage(stockPanel, "Please select an item to edit", "Help");
        } else {
            String[] editStock = new String[5];
            for (int i = 0; i < 5; i++) {
                editStock[i] = (String) stockTable.getValueAt(selRow, i);
            }
            editItem_codeField.setText(editStock[0]);
            editItem_codeField.setEnabled(false);
            editItem_ItemNameField.setText(editStock[1]);
            editItem_sellerField.setText(editStock[2]);
            editItem_quantityField.setText(editStock[3]);
            editItem_priceField.setText(editStock[4]);
            editItemWindow.setLocationRelativeTo(editItemWindow);
            editItemWindow.setVisible(true);
        }
    }//GEN-LAST:event_stock_editButtonActionPerformed

    private void stock_deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stock_deleteButtonActionPerformed
        int selRow = stockTable.getSelectedRow();
        if (selRow == -1) {
            GuiUtil.showInfoMessage(stockPanel, "Please select an item to Delete", "Help");
        } else {
            int ret = JOptionPane.showConfirmDialog(stockPanel, "Do you realy want to delete this item from stock", "Warning", JOptionPane.YES_NO_CANCEL_OPTION);
            if (ret == 0) {
                String code = (String) stockTable.getValueAt(selRow, 0);
                String deleteQuery = "DELETE FROM " + DBConstant.DATABASE + "." + DBConstant.STOCK_TABLE_DB_STRING + " WHERE `Code`='" + code + "'";
                try {
                    db_Connector.delete(deleteQuery);
                    refreshStockTable();
                } catch (SQLException ex) {
                    GuiUtil.showInfoMessage(stockPanel, "Delete operation fail try agian", "Try again");
                }
            }

        }
    }//GEN-LAST:event_stock_deleteButtonActionPerformed

    private void mainwindow_stockManagmentButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainwindow_stockManagmentButtonActionPerformed
        actionChange(Action.STOCK_WINDOW);
    }//GEN-LAST:event_mainwindow_stockManagmentButtonActionPerformed

    private void dailyReports_backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dailyReports_backButtonActionPerformed
        actionChange(Action.DAILY_REPORTS_WINDOW_BACK);
    }//GEN-LAST:event_dailyReports_backButtonActionPerformed

    private void mainwindow_dailyReportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainwindow_dailyReportButtonActionPerformed
        actionChange(Action.DAILY_REPORTS_WINDOW);
    }//GEN-LAST:event_mainwindow_dailyReportButtonActionPerformed

    private void mainwindow_usermanagmentButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainwindow_usermanagmentButtonActionPerformed
        actionChange(Action.USER_MANAGMENT_WINDOW);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_usermanagmentButtonActionPerformed

    private void monthlyReport_showReportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_monthlyReport_showReportButtonActionPerformed
        refreshMonthlyReportTable();
    }//GEN-LAST:event_monthlyReport_showReportButtonActionPerformed

    private void monthlyReports_backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_monthlyReports_backButtonActionPerformed
        actionChange(Action.MONTHLY_REPORT_WINDOW_BACK);
    }//GEN-LAST:event_monthlyReports_backButtonActionPerformed

    private void mainwindow_monthlyReportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainwindow_monthlyReportButtonActionPerformed
        actionChange(Action.MONTHLY_REPORT_WINDOW);
    }//GEN-LAST:event_mainwindow_monthlyReportButtonActionPerformed

    private void userManagement_addUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userManagement_addUserButtonActionPerformed
        addUser_window.setLocationRelativeTo(addUser_window);
        addUser_window.setVisible(true);
    }//GEN-LAST:event_userManagement_addUserButtonActionPerformed

    private void userManagement_editUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userManagement_editUserButtonActionPerformed
//        viewUser_window.setVisible(true);
        //        userManagement_window.setVisible(false);
//        JOptionPane.showMessageDialog(userManagement_window, "Please select a user and then click Edit button", "Edit user help", JOptionPane.INFORMATION_MESSAGE);
    }//GEN-LAST:event_userManagement_editUserButtonActionPerformed

    private void userManagement_deleteUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userManagement_deleteUserButtonActionPerformed
        int selRow = userTable.getSelectedRow();
        if (selRow == -1) {
            GuiUtil.showInfoMessage(usermanagementPanel, "Please select a user and then click Delete button", "Help");
        } else {
            String role = (String) userTable.getValueAt(selRow, 1);
            role = role.trim();
            if (current_user_role == Role.ADMINSTRATOR || (!role.equalsIgnoreCase("Administrator") && !role.equalsIgnoreCase("Manager"))) {
                int ret = JOptionPane.showConfirmDialog(usermanagementPanel, "Do you realy want to delete this user ", "Warning", JOptionPane.YES_NO_CANCEL_OPTION);
                if (ret == 0) {
                    String username = (String) userTable.getValueAt(selRow, 0);
                    String deleteQuery = "DELETE FROM " + DBConstant.DATABASE + "." + DBConstant.CREDENTIAL_TABLE_DB_STRING + " WHERE " + DBConstant.CREDENTIAL_USERNAME + "='" + username + "'";
                    try {
                        db_Connector.delete(deleteQuery);
                        refreshUserTable();
                    } catch (SQLException ex) {
                        GuiUtil.showInfoMessage(usermanagementPanel, "Delete operation fail try agian", "Try again");
                    }
                }
            } else {
                GuiUtil.showWorningMessage(usermanagementPanel, "You don't have privilage to delete this user", "Warning");
            }

        }
    }//GEN-LAST:event_userManagement_deleteUserButtonActionPerformed

    private void userManagement_BackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userManagement_BackButtonActionPerformed
        actionChange(Action.USER_MANAGMENT_WINDOW_BACK);
        //        userManagement_window.setVisible(false);
        //        qpos.setVisible(true);
        //        qpos.setEnabled(true);
    }//GEN-LAST:event_userManagement_BackButtonActionPerformed

    private void userManagement_addUserButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userManagement_addUserButtonFocusGained
        GuiUtil.buttonFocusGained(userManagement_addUserButton);        // TODO add your handling code here:
    }//GEN-LAST:event_userManagement_addUserButtonFocusGained

    private void userManagement_addUserButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userManagement_addUserButtonFocusLost
        GuiUtil.buttonFocusLost(userManagement_addUserButton);        // TODO add your handling code here:
    }//GEN-LAST:event_userManagement_addUserButtonFocusLost

    private void userManagement_editUserButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userManagement_editUserButtonFocusGained
        GuiUtil.buttonFocusGained(userManagement_editUserButton);        // TODO add your handling code here:
    }//GEN-LAST:event_userManagement_editUserButtonFocusGained

    private void userManagement_editUserButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userManagement_editUserButtonFocusLost
        GuiUtil.buttonFocusLost(userManagement_editUserButton);        // TODO add your handling code here:
    }//GEN-LAST:event_userManagement_editUserButtonFocusLost

    private void userManagement_deleteUserButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userManagement_deleteUserButtonFocusGained
        GuiUtil.buttonFocusGained(userManagement_deleteUserButton);        // TODO add your handling code here:
    }//GEN-LAST:event_userManagement_deleteUserButtonFocusGained

    private void userManagement_deleteUserButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userManagement_deleteUserButtonFocusLost
        GuiUtil.buttonFocusLost(userManagement_deleteUserButton);        // TODO add your handling code here:
    }//GEN-LAST:event_userManagement_deleteUserButtonFocusLost

    private void userManagement_BackButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userManagement_BackButtonFocusGained
        GuiUtil.buttonFocusGained(userManagement_BackButton);        // TODO add your handling code here:
    }//GEN-LAST:event_userManagement_BackButtonFocusGained

    private void userManagement_BackButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userManagement_BackButtonFocusLost
        GuiUtil.buttonFocusLost(userManagement_BackButton);        // TODO add your handling code here:
    }//GEN-LAST:event_userManagement_BackButtonFocusLost

    private void mainwindow_stockManagmentButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_stockManagmentButtonFocusGained
        GuiUtil.buttonFocusGained(mainwindow_stockManagmentButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_stockManagmentButtonFocusGained

    private void mainwindow_stockManagmentButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_stockManagmentButtonFocusLost
        GuiUtil.buttonFocusLost(mainwindow_stockManagmentButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_stockManagmentButtonFocusLost

    private void mainwindow_usermanagmentButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_usermanagmentButtonFocusGained
        GuiUtil.buttonFocusGained(mainwindow_usermanagmentButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_usermanagmentButtonFocusGained

    private void mainwindow_usermanagmentButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_usermanagmentButtonFocusLost
        GuiUtil.buttonFocusLost(mainwindow_usermanagmentButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_usermanagmentButtonFocusLost

    private void mainwindow_dailyReportButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_dailyReportButtonFocusGained
        GuiUtil.buttonFocusGained(mainwindow_dailyReportButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_dailyReportButtonFocusGained

    private void mainwindow_dailyReportButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_dailyReportButtonFocusLost
        GuiUtil.buttonFocusLost(mainwindow_dailyReportButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_dailyReportButtonFocusLost

    private void mainwindow_monthlyReportButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_monthlyReportButtonFocusGained
        GuiUtil.buttonFocusGained(mainwindow_monthlyReportButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_monthlyReportButtonFocusGained

    private void mainwindow_monthlyReportButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_monthlyReportButtonFocusLost
        GuiUtil.buttonFocusLost(mainwindow_monthlyReportButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_monthlyReportButtonFocusLost

    private void mainwindow_startButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_startButtonFocusGained
        GuiUtil.buttonFocusGained(mainwindow_startButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_startButtonFocusGained

    private void mainwindow_startButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_startButtonFocusLost
        GuiUtil.buttonFocusLost(mainwindow_startButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_startButtonFocusLost

    private void mainwindow_exitButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_exitButtonFocusGained
        GuiUtil.buttonFocusGained(mainwindow_exitButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_exitButtonFocusGained

    private void mainwindow_exitButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mainwindow_exitButtonFocusLost
        GuiUtil.buttonFocusLost(mainwindow_exitButton);        // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_exitButtonFocusLost

    private void stock_addButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_addButtonFocusGained
        GuiUtil.buttonFocusGained(stock_addButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_addButtonFocusGained

    private void stock_addButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_addButtonFocusLost
        GuiUtil.buttonFocusLost(stock_addButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_addButtonFocusLost

    private void stock_editButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_editButtonFocusGained
        GuiUtil.buttonFocusGained(stock_editButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_editButtonFocusGained

    private void stock_editButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_editButtonFocusLost
        GuiUtil.buttonFocusLost(stock_editButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_editButtonFocusLost

    private void stock_deleteButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_deleteButtonFocusGained
        GuiUtil.buttonFocusGained(stock_deleteButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_deleteButtonFocusGained

    private void stock_deleteButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_deleteButtonFocusLost
        GuiUtil.buttonFocusLost(stock_deleteButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_deleteButtonFocusLost

    private void stock_cancelButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_cancelButtonFocusGained
        GuiUtil.buttonFocusGained(stock_cancelButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_cancelButtonFocusGained

    private void stock_cancelButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_cancelButtonFocusLost
        GuiUtil.buttonFocusLost(stock_cancelButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_cancelButtonFocusLost

    private void stock_backButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_backButtonFocusGained
        GuiUtil.buttonFocusGained(stock_backButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_backButtonFocusGained

    private void stock_backButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_stock_backButtonFocusLost
        GuiUtil.buttonFocusLost(stock_backButton);        // TODO add your handling code here:
    }//GEN-LAST:event_stock_backButtonFocusLost

    private void dailyReports_backButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_dailyReports_backButtonFocusGained
        GuiUtil.buttonFocusGained(dailyReports_backButton);        // TODO add your handling code here:
    }//GEN-LAST:event_dailyReports_backButtonFocusGained

    private void dailyReports_backButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_dailyReports_backButtonFocusLost
        GuiUtil.buttonFocusLost(dailyReports_backButton);        // TODO add your handling code here:
    }//GEN-LAST:event_dailyReports_backButtonFocusLost

    private void monthlyReport_showReportButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_monthlyReport_showReportButtonFocusGained
        GuiUtil.buttonFocusGained(monthlyReport_showReportButton);        // TODO add your handling code here:
    }//GEN-LAST:event_monthlyReport_showReportButtonFocusGained

    private void monthlyReport_showReportButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_monthlyReport_showReportButtonFocusLost
        GuiUtil.buttonFocusLost(monthlyReport_showReportButton);        // TODO add your handling code here:
    }//GEN-LAST:event_monthlyReport_showReportButtonFocusLost

    private void monthlyReports_backButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_monthlyReports_backButtonFocusGained
        GuiUtil.buttonFocusGained(monthlyReports_backButton);        // TODO add your handling code here:
    }//GEN-LAST:event_monthlyReports_backButtonFocusGained

    private void monthlyReports_backButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_monthlyReports_backButtonFocusLost
        GuiUtil.buttonFocusLost(monthlyReports_backButton);
        // TODO add your handling code here:
    }//GEN-LAST:event_monthlyReports_backButtonFocusLost

    private void order_addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_order_addButtonActionPerformed
        try {
            refreshSearchTable(null, false);
        } catch (SQLException ex) {
            GuiUtil.showErrorMessage(orderPanel, "Error retriving data from stock Table", "Error");
        }

        itemSearch_window.setLocationRelativeTo(itemSearch_window);
        itemSearch_window.setVisible(true);
        searchByName_Field.requestFocusInWindow();

    }//GEN-LAST:event_order_addButtonActionPerformed

    private void order_backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_order_backButtonActionPerformed
        int i = JOptionPane.showConfirmDialog(orderPanel, "Do you need to cancel this order and go to main window?");
        if(i==0){
            actionChange(Action.OEDER_WINDOW_BACK);
        }else {
            // do nothing
        }

    }//GEN-LAST:event_order_backButtonActionPerformed

    private void order_payButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_order_payButtonActionPerformed
        if(order!= null && order.getItemCount()>0){
                    payWindow.setSize(Constants.PAY_WINDOW_WIDTH, Constants.PAY_WINDOW_HEIGTH);
        payWindow.setLocationRelativeTo(payWindow);
        lineDisplay(order.getTotalAsMoneyString(), "2");
        payWindow_totalField.setText(order.getTotalAsMoneyString());
        payWindow.setVisible(true);
        payWindow_cashField.requestFocusInWindow();
        }else{
            GuiUtil.showInfoMessage(orderPanel, "There is no billing items to pay", "No Items");
        }
    }//GEN-LAST:event_order_payButtonActionPerformed

    private void order_payButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_payButtonFocusGained
        GuiUtil.buttonFocusGained(order_payButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_payButtonFocusGained

    private void order_payButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_payButtonFocusLost
        GuiUtil.buttonFocusLost(order_payButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_payButtonFocusLost

    private void order_addButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_addButtonFocusGained
        GuiUtil.buttonFocusGained(order_addButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_addButtonFocusGained

    private void order_addButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_addButtonFocusLost
        GuiUtil.buttonFocusLost(order_addButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_addButtonFocusLost

    private void orderPanelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_orderPanelFocusGained
        // TODO add your handling code here:
    }//GEN-LAST:event_orderPanelFocusGained

    private void order_removeButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_removeButtonFocusGained
        GuiUtil.buttonFocusGained(order_removeButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_removeButtonFocusGained

    private void order_removeButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_removeButtonFocusLost
        GuiUtil.buttonFocusLost(order_removeButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_removeButtonFocusLost

    private void order_cancelButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_cancelButtonFocusGained
        GuiUtil.buttonFocusGained(order_cancelButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_cancelButtonFocusGained

    private void order_cancelButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_cancelButtonFocusLost
        GuiUtil.buttonFocusLost(order_cancelButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_cancelButtonFocusLost

    private void order_backButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_backButtonFocusGained
        GuiUtil.buttonFocusGained(order_backButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_backButtonFocusGained

    private void order_backButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_order_backButtonFocusLost
        GuiUtil.buttonFocusLost(order_backButton);        // TODO add your handling code here:
    }//GEN-LAST:event_order_backButtonFocusLost

    private void mainwindow_startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainwindow_startButtonActionPerformed
        actionChange(Action.OEDER_WINDOW);             // TODO add your handling code here:
    }//GEN-LAST:event_mainwindow_startButtonActionPerformed

    private void editItem_sellerFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editItem_sellerFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_editItem_sellerFieldActionPerformed

    private void editItem_quantityFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editItem_quantityFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_editItem_quantityFieldActionPerformed

    private void editItems_okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editItems_okButtonActionPerformed
        String name = editItem_ItemNameField.getText().trim();
        String code = editItem_codeField.getText().trim();
        String pirce = editItem_priceField.getText().trim();
        String seller = editItem_sellerField.getText().trim();
        String qty = editItem_quantityField.getText().trim();
        try {
            String updateQuery = "UPDATE " + DBConstant.DATABASE + "." + DBConstant.STOCK_TABLE_DB_STRING
                    + " SET `" + DBConstant.STOCK_NAME + "`='" + name + "' , "
                    + "`" + DBConstant.STOCK_SELLER + "`='" + seller + "' , "
                    + "`" + DBConstant.STOCK_UNIT_PRICE + "`='" + pirce + "' , "
                    + "`" + DBConstant.STOCK_QTY + "`='" + qty + "' , "
                    + "`" + DBConstant.STOCK_DATE + "`= " + "CURRENT_DATE() , "
                    + "`" + DBConstant.STOCK_TIMESTAMP + "`= " + "CURRENT_TIMESTAMP() "
                    + " WHERE `" + DBConstant.STOCK_CODE + "`='" + code + "';";

            db_Connector.update(updateQuery);
            editItemWindow.setVisible(false);
            refreshStockTable();

        } catch (SQLException ex) {
            GuiUtil.showInfoMessage(editItemPanel, "Error while updating stock", "Error");
        }
    }//GEN-LAST:event_editItems_okButtonActionPerformed

    private void editItems_backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editItems_backButtonActionPerformed
        editItemWindow.setVisible(false);
        editItem_ItemNameField.setText("");
        editItem_codeField.setText("");
        editItem_priceField.setText("");
        editItem_sellerField.setText("");
        editItem_quantityField.setText("");
    }//GEN-LAST:event_editItems_backButtonActionPerformed

    private void addItems_quantityFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addItems_quantityFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_addItems_quantityFieldActionPerformed

    private void addItems_priceFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addItems_priceFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_addItems_priceFieldActionPerformed

    private void addItemsAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addItemsAddButtonActionPerformed
        String code = addItem_codeField.getText().trim();
        String item_name = addItems_ItemNameField.getText().trim();
        String qty = addItems_quantityField.getText().trim();
        String seller = addItems_sellerField.getText().trim();
        String price =addItems_priceField.getText().trim();
        if (code == null || code.equals("")
                || item_name == null || item_name.equals("")
                || qty == null || qty.equals("")
                || price == null || price.equals("")) {
            GuiUtil.showErrorMessage(addItemsPanel, "Code , Item Name , "
                    + "Quantity or Price fields should not be empty  ", "Data missing");
        } else {
            price =  moneyFormat.format(Double.valueOf(price));
            isAdditem = true;
            StockItem item = new StockItem(code, item_name, seller, Integer.valueOf(qty), Double.valueOf(price));
            addItemsCancelButtonActionPerformed(evt);
            try {
                db_Connector.insert(item);
            } catch (SQLException ex) {
                GuiUtil.showErrorMessage(addItemsPanel, "error adding --> " + item.toString() + " to database", "Error while inserting data");
            }
        }
    }//GEN-LAST:event_addItemsAddButtonActionPerformed

    private void addItemsCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addItemsCancelButtonActionPerformed
        addItem_codeField.setText("");
        addItems_ItemNameField.setText("");
        addItems_quantityField.setText("");
        addItems_sellerField.setText("");
        addItems_priceField.setText("");
        //        addItems_totaLabel.setText("");
    }//GEN-LAST:event_addItemsCancelButtonActionPerformed

    private void addItemsBackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addItemsBackButtonActionPerformed
        addItemsCancelButtonActionPerformed(evt);
        if (isAdditem) {
            try {
                refreshStockTable();
            } catch (SQLException ex) {
                GuiUtil.showErrorMessage(addItemsPanel, "Error updating Stock Table", "Error");
            }
        }
        isAdditem = false;
        addItemWindow.setVisible(false);
    }//GEN-LAST:event_addItemsBackButtonActionPerformed

    private void addUser_addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addUser_addButtonActionPerformed
        String userName = addUser_nameField.getText().trim();
        char[] password = addUser_passwordField.getPassword();
        char[] rePassword = addUser_rePasswordField.getPassword();
        String role = addUser_roleComboBox.getSelectedItem().toString();
        int role_id = -1;
        if (role.equals(Constants.ROLE_USER)) {
            role_id = Role.USER.id;
        } else if (role.equals(Constants.ROLE_EMPLOYEE)) {
            role_id = Role.EMPLOYEE.id;
        } else if (role.equals(Constants.ROLE_MANAGER)) {
            role_id = Role.MANAGER.id;
        } else if (role.equals(Constants.ROLE_ADMIN)) {
            role_id = Role.ADMINSTRATOR.id;
        }

        if (current_user_role.id < role_id || current_user_role.id == Role.ADMINSTRATOR.id) {
            if (userName.length() > 0) {
                if (password.length >= 5) {
                    if (password.length == rePassword.length) {
                        for (int i = 0; i < password.length; i++) {
                            if (password[i] == rePassword[i]) {
                                continue;
                            } else {
                                adduser_passwordErrorLabel.setText("Password miss match");
                                addUser_passwordField.setText("");
                                addUser_rePasswordField.setText("");
                                addUser_roleComboBox.setSelectedIndex(0);
                                return;
                            }
                        }
                        try {
                            if (db_Connector.isUserNameExist(userName)) {
                                addUser_cancelButtonActionPerformed(evt);
                                JOptionPane.showMessageDialog(this, "Username " + userName + " already exist", "Username Exist", JOptionPane.INFORMATION_MESSAGE);
                            } else {
                                int ret = db_Connector.insert("credential",
                                        new String[]{DBConstant.CREDENTIAL_USERNAME,
                                            DBConstant.CREDENTIAL_PASSWORD,
                                            DBConstant.CREDENTIAL_ROLE,
                                            DBConstant.CREDENTIAL_DATE},
                                        new String[]{userName, String.copyValueOf(password),
                                            String.valueOf(role_id)});
                                addUser_cancelButtonActionPerformed(evt);
                                JOptionPane.showMessageDialog(this, "Successfully added user " + userName + " to the database");
                            }

                        } catch (SQLException ex) {
                            JOptionPane.showMessageDialog(this, "Error adding user " + userName + " to the database");
                        }
                    } else {
                        adduser_passwordErrorLabel.setText("Password miss match");
                        addUser_passwordField.setText("");
                        addUser_rePasswordField.setText("");
                        addUser_roleComboBox.setSelectedIndex(0);
                        addUser_passwordField.requestFocusInWindow();
                    }
                } else {
                    addUser_passwordField.setText("");
                    addUser_rePasswordField.setText("");
                    addUser_roleComboBox.setSelectedIndex(0);
                    addUser_passwordField.requestFocusInWindow();
                    JOptionPane.showMessageDialog(this, "Please entere atleast 5 character lenth password", "Password Hint", JOptionPane.WARNING_MESSAGE);
                }
            } else {
                addUser_passwordField.setText("");
                addUser_rePasswordField.setText("");
                addUser_roleComboBox.setSelectedIndex(0);
                addUser_nameField.requestFocusInWindow();
                JOptionPane.showMessageDialog(this, "Please entere User name", "Username Hint", JOptionPane.WARNING_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(addUser_window, "You don't have privilage to add this user", "Error", JOptionPane.ERROR_MESSAGE);
        }

    }//GEN-LAST:event_addUser_addButtonActionPerformed

    private void addUser_backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addUser_backButtonActionPerformed
        addUser_cancelButtonActionPerformed(evt);
        try {
            refreshUserTable();
        } catch (SQLException ex) {
            GuiUtil.showErrorMessage(stockPanel, "Error updating User Table", "Error");
        }
        addUser_window.setVisible(false);
    }//GEN-LAST:event_addUser_backButtonActionPerformed

    private void addUser_cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addUser_cancelButtonActionPerformed
        addUser_nameField.setText("");
        addUser_passwordField.setText("");
        addUser_rePasswordField.setText("");
        addUser_roleComboBox.setSelectedIndex(0);
    }//GEN-LAST:event_addUser_cancelButtonActionPerformed

    private void addUser_windowWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_addUser_windowWindowClosing
        addUser_backButtonActionPerformed(null);
    }//GEN-LAST:event_addUser_windowWindowClosing

    private void searchByCode_FieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchByCode_FieldFocusGained
        searchByName_Field.setText("");
    }//GEN-LAST:event_searchByCode_FieldFocusGained

    private void searchByName_FieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_searchByName_FieldFocusGained
        searchByCode_Field.setText("");
    }//GEN-LAST:event_searchByName_FieldFocusGained

    private void itemSearch_windowWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_itemSearch_windowWindowClosing
        itemSearch_window.setVisible(false);
    }//GEN-LAST:event_itemSearch_windowWindowClosing

    private void mainwindow_exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainwindow_exitButtonActionPerformed
        exitComformDialog.setSize(exitComformDialog.getPreferredSize());
        exitComformDialog.setLocationRelativeTo(exitComformDialog);
        exitComformDialog.setVisible(true);
    }//GEN-LAST:event_mainwindow_exitButtonActionPerformed

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowClosed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        mainwindow_exitButtonActionPerformed(null);
    }//GEN-LAST:event_formWindowClosing

    private void payWindow_printButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_payWindow_printButtonActionPerformed
        PosPrinter printer = new PosPrinter(order, isPrinterPresent);
        printer.printBill();
        try {
            updateDatabase(order);
//            segmentCheck = true;
            lineDisplay(order.getBalanceAsMoneyString(), "4");
        } catch (SQLException ex) {
            GuiUtil.showErrorMessage(payWindowPanel, "Error while updating stock Please contact developer to resolve this", "Error");
        }
        nextCutom_MainWindow.setLocationRelativeTo(nextCutom_MainWindow);
        nextCutom_MainWindow.setVisible(true);
        payWindow_cancelButtonActionPerformed(evt);
    }//GEN-LAST:event_payWindow_printButtonActionPerformed

    private void payWindow_cashFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_payWindow_cashFieldFocusLost
        String caseString = payWindow_cashField.getText().trim();
        payWindow_cashField.setText(moneyFormat.format(Double.valueOf(caseString)));
        caseString = payWindow_cashField.getText().trim();
        String totalString = payWindow_totalField.getText();
        if (caseString == null || caseString.equals("")) {
        } else {
//            segmentCheck = true;
            lineDisplay(caseString, "3");
            double cash = Double.valueOf(caseString);
            double total = Double.valueOf(totalString);
            double balance = cash - total;
            payWindow_balanceField.setText(moneyFormat.format(balance));
            order.setCash(cash);

        }
    }//GEN-LAST:event_payWindow_cashFieldFocusLost

    private void dailyReport_showReportButtonFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_dailyReport_showReportButtonFocusLost
        GuiUtil.buttonFocusLost(dailyReport_showReportButton);        // TODO add your handling code here:
    }//GEN-LAST:event_dailyReport_showReportButtonFocusLost

    private void dailyReport_showReportButtonFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_dailyReport_showReportButtonFocusGained
        GuiUtil.buttonFocusGained(dailyReport_showReportButton);        // TODO add your handling code here:
    }//GEN-LAST:event_dailyReport_showReportButtonFocusGained

    private void dailyReport_showReportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dailyReport_showReportButtonActionPerformed
        refreshDailyReportTable();
    }//GEN-LAST:event_dailyReport_showReportButtonActionPerformed

    private void nextCustomerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextCustomerButtonActionPerformed
        order = null;
        orderDataTable.clear();
        orderTable.setModel(orderDataTable);
        order_invoiceLabel.setText("");
        order_totalLabel.setText("0.00");
        lineDisplay("0.00", "0");
//        segmentCheck = false;

        nextCutom_MainWindow.setVisible(false);
    }//GEN-LAST:event_nextCustomerButtonActionPerformed

    private void payWindow_cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_payWindow_cancelButtonActionPerformed
        payWindow_cashField.setText("");
        payWindow_totalField.setText("");
        payWindow_balanceField.setText("");
        payWindow.setVisible(false);
    }//GEN-LAST:event_payWindow_cancelButtonActionPerformed

    private void mainWindowButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainWindowButtonActionPerformed
        nextCustomerButtonActionPerformed(evt);
        actionChange(Action.OEDER_WINDOW_BACK);
    }//GEN-LAST:event_mainWindowButtonActionPerformed

    private void monthlyReport_yearComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_monthlyReport_yearComboActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_monthlyReport_yearComboActionPerformed

    private void order_removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_order_removeButtonActionPerformed
        int sr = orderTable.getSelectedRow();
        if(sr != -1){
            int i = JOptionPane.showConfirmDialog(orderPanel, "Do you need to remove this order item form the order?7");
            if(i==0){
                           String code = (String)orderTable.getValueAt(sr, 0);
            String qty = (String)orderTable.getValueAt(sr, 3);
            order.removeOrderItem(code, Integer.valueOf(qty));
            order_totalLabel.setText(order.getTotalAsMoneyString());
            orderDataTable.removeItem(sr); 
            }else {
                // do nothing
            }
            
        }else{
            GuiUtil.showInfoMessage(orderPanel, "Please select an order item to be removed", "Select to Remove");
        }
    }//GEN-LAST:event_order_removeButtonActionPerformed

    private void order_cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_order_cancelButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_order_cancelButtonActionPerformed

    private void exitDialog_yesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitDialog_yesButtonActionPerformed
        BufferedWriter bw = null;
        try {
            File dataFile = new File(MainWindow.DATA_FILE);
            bw = new BufferedWriter(new FileWriter(dataFile));
            bw.write(MainWindow.INVOICE_NUM + "");
            bw.close();
        } catch (IOException ex) {
            Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.current_user = "";
        exitComformDialog.setVisible(false);
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new StartWindow().setVisible(true);
            }
        });
        this.dispose();
    }//GEN-LAST:event_exitDialog_yesButtonActionPerformed

    private void exitDialog_noButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitDialog_noButtonActionPerformed
       exitComformDialog.setVisible(false);
    }//GEN-LAST:event_exitDialog_noButtonActionPerformed

    private void exitDialog_cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitDialog_cancelButtonActionPerformed
       exitComformDialog.setVisible(false);
    }//GEN-LAST:event_exitDialog_cancelButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainWindow().setVisible(true);
            }
        });
    }

    private void actionChange(Action action) {

        currentAction = action;
        processCurrentAction();

    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JFrame addItemWindow;
    private javax.swing.JTextField addItem_codeField;
    private javax.swing.JButton addItemsAddButton;
    private javax.swing.JButton addItemsBackButton;
    private javax.swing.JButton addItemsCancelButton;
    private javax.swing.JPanel addItemsPanel;
    private javax.swing.JTextField addItems_ItemNameField;
    private javax.swing.JTextField addItems_priceField;
    private javax.swing.JTextField addItems_quantityField;
    private javax.swing.JTextField addItems_sellerField;
    private javax.swing.JPanel addUserPanel;
    private javax.swing.JButton addUser_addButton;
    private javax.swing.JButton addUser_backButton;
    private javax.swing.JButton addUser_cancelButton;
    private javax.swing.JTextField addUser_nameField;
    private javax.swing.JPasswordField addUser_passwordField;
    private javax.swing.JPasswordField addUser_rePasswordField;
    private javax.swing.JComboBox addUser_roleComboBox;
    private javax.swing.JFrame addUser_window;
    private javax.swing.JLabel adduser_passwordErrorLabel;
    private javax.swing.JPanel dailyReportPanel;
    private javax.swing.JComboBox dailyReport_dayCombo;
    private javax.swing.JComboBox dailyReport_monthCombo;
    private javax.swing.JButton dailyReport_showReportButton;
    private javax.swing.JTable dailyReport_table;
    private javax.swing.JComboBox dailyReport_yearCombo;
    private javax.swing.JButton dailyReports_backButton;
    private javax.swing.JPanel editItemPanel;
    private javax.swing.JFrame editItemWindow;
    private javax.swing.JTextField editItem_ItemNameField;
    private javax.swing.JTextField editItem_codeField;
    private javax.swing.JTextField editItem_priceField;
    private javax.swing.JTextField editItem_quantityField;
    private javax.swing.JTextField editItem_sellerField;
    private javax.swing.JButton editItems_backButton;
    private javax.swing.JButton editItems_okButton;
    private javax.swing.JDialog exitComformDialog;
    private javax.swing.JButton exitDialog_cancelButton;
    private javax.swing.JButton exitDialog_noButton;
    private javax.swing.JButton exitDialog_yesButton;
    private javax.swing.JTable itemSearchTable;
    private javax.swing.JFrame itemSearch_window;
    private javax.swing.JPanel itemSerach_panel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JButton mainWindowButton;
    private javax.swing.JButton mainwindow_dailyReportButton;
    private javax.swing.JButton mainwindow_exitButton;
    private javax.swing.JPanel mainwindow_internalPanel;
    private javax.swing.JButton mainwindow_monthlyReportButton;
    private javax.swing.JPanel mainwindow_mypanel;
    private javax.swing.JPanel mainwindow_panel;
    private javax.swing.JButton mainwindow_startButton;
    private javax.swing.JButton mainwindow_stockManagmentButton;
    private javax.swing.JButton mainwindow_usermanagmentButton;
    private javax.swing.JPanel monthlyReportPanel;
    private javax.swing.JComboBox monthlyReport_monthCombo;
    private javax.swing.JButton monthlyReport_showReportButton;
    private javax.swing.JTable monthlyReport_table;
    private javax.swing.JComboBox monthlyReport_yearCombo;
    private javax.swing.JButton monthlyReports_backButton;
    private javax.swing.JButton nextCustomerButton;
    private javax.swing.JFrame nextCutom_MainWindow;
    private javax.swing.JPanel orderItemAdd_Panel;
    private javax.swing.JFrame orderItemAdd_window;
    private javax.swing.JLabel orderItem_codeLabel;
    private javax.swing.JLabel orderItem_nameLabel;
    private javax.swing.JLabel orderItem_priceLabel1;
    private javax.swing.JTextField orderItem_qtyField;
    private javax.swing.JLabel orderItem_qtyLabel;
    private javax.swing.JLabel orderItem_sellerLabel;
    private javax.swing.JPanel orderPanel;
    private javax.swing.JTable orderTable;
    private javax.swing.JButton order_addButton;
    private javax.swing.JButton order_backButton;
    private javax.swing.JButton order_cancelButton;
    private javax.swing.JLabel order_invoiceLabel;
    private javax.swing.JButton order_payButton;
    private javax.swing.JButton order_removeButton;
    private javax.swing.JLabel order_totalLabel;
    private javax.swing.JLabel order_usernameLabel;
    private javax.swing.JFrame payWindow;
    private javax.swing.JPanel payWindowPanel;
    private javax.swing.JTextField payWindow_balanceField;
    private javax.swing.JButton payWindow_cancelButton;
    private javax.swing.JTextField payWindow_cashField;
    private javax.swing.JButton payWindow_printButton;
    private javax.swing.JTextField payWindow_totalField;
    private javax.swing.JTextField searchByCode_Field;
    private javax.swing.JTextField searchByName_Field;
    private javax.swing.JPanel stockPanel;
    private javax.swing.JTable stockTable;
    private javax.swing.JScrollPane stockTableScrollPane;
    private javax.swing.JButton stock_addButton;
    private javax.swing.JButton stock_backButton;
    private javax.swing.JButton stock_cancelButton;
    private javax.swing.JButton stock_deleteButton;
    private javax.swing.JButton stock_editButton;
    private javax.swing.JLabel stock_usernameLabel;
    private javax.swing.JButton userManagement_BackButton;
    private javax.swing.JButton userManagement_addUserButton;
    private javax.swing.JButton userManagement_deleteUserButton;
    private javax.swing.JButton userManagement_editUserButton;
    private javax.swing.JTable userTable;
    private javax.swing.JPanel usermanagementPanel;
    // End of variables declaration//GEN-END:variables

    public String getCurrent_user() {
        return current_user;
    }

    private void updateDatabase(Order order) throws SQLException {
        updateInvoiceTable(order);
        for (OrderItem item : order.getItems()) {
            updateStock(item.getCode(), item.getAmount());
        }
    }

    private void updateStock(String code, int qty) throws SQLException {
        ResultSet res = db_Connector.select("SELECT QTY FROM stock WHERE CODE='" + code + "'");
        if (res != null) {
            res.first();
            String q = res.getString("QTY");
            int prvQty = Integer.valueOf(q);
            int nextQty = prvQty - qty;
            String updateQuery = "UPDATE " + DBConstant.DATABASE + "." + DBConstant.STOCK_TABLE_DB_STRING
                    + " SET `" + DBConstant.STOCK_QTY + "`='" + nextQty + "' "
                    + " WHERE `" + DBConstant.STOCK_CODE + "`='" + code + "';";
            db_Connector.update(updateQuery);
        }
    }

    public String getInvoiceNum() {
        MainWindow.INVOICE_NUM += 1;
        return invoiceFormatter.format(MainWindow.INVOICE_NUM);
    }

    private void lineDisplay(String price, String type) {
        ssd.setCommand(price, type);
    }

    public void setCurrent_user(String current_user, Role role) {
        this.current_user = current_user;
        this.current_user_role = role;
    }

    public void refreshStockTable() throws SQLException {
        ResultSet stockRes = db_Connector.retrieveAllvalues(DBConstant.STOCK_TABLE_DB_STRING);
        StockDataTable stockDataTable = new StockDataTable(stockRes);
        stockTable.setModel(stockDataTable);
    }

    public void refreshUserTable() throws SQLException {
        ResultSet stockRes = db_Connector.retrieveAllvalues(DBConstant.CREDENTIAL_TABLE_DB_STRING);
        UserDataTable userDataTable = new UserDataTable(stockRes);
        userTable.setModel(userDataTable);
    }

    public void refreshSearchTable(String key, boolean isName) throws SQLException {
        ResultSet searchRes;
        if (key == null || key.equals("")) {
            searchRes = db_Connector.retrieveAllvalues(DBConstant.STOCK_TABLE_DB_STRING);
        } else {
            if (isName) {
                searchRes = db_Connector.select("SELECT * FROM stock WHERE NAME LIKE '%" + key + "%'");
            } else {
                searchRes = db_Connector.select("SELECT * FROM stock WHERE CODE LIKE '%" + key + "%'");
            }
        }
        OrderSearchTable orderDataTable = new OrderSearchTable(searchRes);
        itemSearchTable.setModel(orderDataTable);
    }

    private void processCurrentAction() {
        boolean enable = true;
        if (currentAction == Action.STOCK_WINDOW) {
            mainwindow_mypanel.setVisible(false);
            mainwindow_internalPanel.remove(mainwindow_mypanel);
            mainwindow_internalPanel.add(stockPanel);
            try {
                refreshStockTable();
            } catch (SQLException ex) {
                GuiUtil.showErrorMessage(stockPanel, "Error updating Stock Table", "Error");
            }
            stock_usernameLabel.setText(current_user);
            stockPanel.setVisible(true);
            stock_addButton.requestFocusInWindow();
            enable = false;
        } else if (currentAction == Action.STOCK_WINDOW_BACK) {
            stockPanel.setVisible(false);
            mainwindow_internalPanel.remove(stockPanel);
            mainwindow_mypanel.setVisible(true);
            mainwindow_internalPanel.add(mainwindow_mypanel);
            enable = true;
        } else if (currentAction == Action.USER_MANAGMENT_WINDOW) {
            mainwindow_mypanel.setVisible(false);
            mainwindow_internalPanel.remove(mainwindow_mypanel);
            mainwindow_internalPanel.add(usermanagementPanel);
            try {
                refreshUserTable();
            } catch (SQLException ex) {
                GuiUtil.showErrorMessage(stockPanel, "Error updating User Table", "Error");
            }
            usermanagementPanel.setVisible(true);
            usermanagementPanel.requestFocusInWindow();
            enable = false;
        } else if (currentAction == Action.USER_MANAGMENT_WINDOW_BACK) {
            usermanagementPanel.setVisible(false);
            mainwindow_internalPanel.remove(usermanagementPanel);
            mainwindow_internalPanel.add(mainwindow_mypanel);
            mainwindow_mypanel.setVisible(true);
            enable = true;
        } else if (currentAction == Action.OEDER_WINDOW) {
            mainwindow_mypanel.setVisible(false);
            mainwindow_internalPanel.remove(mainwindow_mypanel);
            mainwindow_internalPanel.add(orderPanel);
            enterOrderWindow();
            orderPanel.setVisible(true);
            orderPanel.requestFocusInWindow();
            enable = false;
        } else if (currentAction == Action.OEDER_WINDOW_BACK) {
            orderPanel.setVisible(false);
            nextCustomerButtonActionPerformed(null);
            mainwindow_internalPanel.remove(orderPanel);
            mainwindow_internalPanel.add(mainwindow_mypanel);
            mainwindow_mypanel.setVisible(true);
            enable = true;
        } else if (currentAction == Action.DAILY_REPORTS_WINDOW) {
            mainwindow_mypanel.setVisible(false);
            mainwindow_internalPanel.remove(mainwindow_mypanel);
            dailyReportPanel.setVisible(true);
            refreshDailyReportTable();
            mainwindow_internalPanel.add(dailyReportPanel);
            dailyReportPanel.requestFocusInWindow();
            enable = false;
        } else if (currentAction == Action.DAILY_REPORTS_WINDOW_BACK) {
            dailyReportPanel.setVisible(false);
            mainwindow_mypanel.setVisible(true);
            mainwindow_internalPanel.remove(dailyReportPanel);
            mainwindow_internalPanel.add(mainwindow_mypanel);
            enable = true;
        } else if (currentAction == Action.MONTHLY_REPORT_WINDOW) {
            mainwindow_mypanel.setVisible(false);
            mainwindow_internalPanel.remove(mainwindow_mypanel);
            mainwindow_internalPanel.add(monthlyReportPanel);
            monthlyReportPanel.setVisible(true);
            refreshMonthlyReportTable();
            monthlyReportPanel.requestFocusInWindow();
            enable = false;
        } else if (currentAction == Action.MONTHLY_REPORT_WINDOW_BACK) {
            monthlyReportPanel.setVisible(false);
            mainwindow_internalPanel.remove(monthlyReportPanel);
            mainwindow_internalPanel.add(mainwindow_mypanel);
            mainwindow_mypanel.setVisible(true);
            enable = true;
        }
        enableAllMainfunctionButtons(enable);
        mainwindow_internalPanel.validate();

    }

    private void setSizes() {
        mainwindow_mypanel.setSize(Constants.INNER_PANEL_WIDTH, Constants.INNER_PANEL_HEIGHT);
//        mainwindow_mypanel.setBorder(new BevelBorder(BevelBorder.RAISED));

        stockPanel.setSize(Constants.INNER_PANEL_WIDTH, Constants.INNER_PANEL_HEIGHT);
//        stockPanel.setBorder(new BevelBorder(BevelBorder.RAISED));
        addItemWindow.setSize(Constants.AED_WINDOW_WIDTH, Constants.AED_WINDOW_HEIGHT);
        editItemWindow.setSize(Constants.AED_WINDOW_WIDTH, Constants.AED_WINDOW_HEIGHT);

        dailyReportPanel.setSize(Constants.INNER_PANEL_WIDTH, Constants.INNER_PANEL_HEIGHT);
//        dailyReportPanel.setBorder(new BevelBorder(BevelBorder.RAISED));

        monthlyReportPanel.setSize(Constants.INNER_PANEL_WIDTH, Constants.INNER_PANEL_HEIGHT);
//        monthlyReportPanel.setBorder(new BevelBorder(BevelBorder.RAISED));

        usermanagementPanel.setSize(Constants.INNER_PANEL_WIDTH, Constants.INNER_PANEL_HEIGHT);
        addUser_window.setSize(Constants.AED_WINDOW_WIDTH, Constants.AED_WINDOW_HEIGHT);

        orderPanel.setSize(Constants.INNER_PANEL_WIDTH, Constants.INNER_PANEL_HEIGHT);
        itemSearch_window.setSize(Constants.SEARCH_WINDOW_WIDTH, Constants.SEARCH_WINDOW_HEIGTH);
        orderItemAdd_window.setSize(Constants.ORDER_ADD_WINDOW_WIDTH, Constants.ORDER_ADD_WINDOW_HEIGHT);

        nextCutom_MainWindow.setSize(Constants.MAIN_WINDOW_OR_NEXT_CUSTOMER_WIDTH, Constants.MAIN_WINDOW_OR_NEXT_CUSTOMER_HEIGHT);

        mainwindow_internalPanel.add(mainwindow_mypanel);
    }

    private void enableAllMainfunctionButtons(boolean enable) {
        if (current_user_role == Role.ADMINSTRATOR || current_user_role == Role.MANAGER) {
            mainwindow_stockManagmentButton.setEnabled(enable);
            mainwindow_usermanagmentButton.setEnabled(enable);
            mainwindow_startButton.setEnabled(enable);
            mainwindow_dailyReportButton.setEnabled(enable);
            mainwindow_monthlyReportButton.setEnabled(enable);
            mainwindow_exitButton.setEnabled(enable);
        } else if (current_user_role == Role.EMPLOYEE) {
            mainwindow_startButton.setEnabled(enable);
            mainwindow_dailyReportButton.setEnabled(enable);
            mainwindow_monthlyReportButton.setEnabled(enable);
            mainwindow_exitButton.setEnabled(enable);
        } else if (current_user_role == Role.USER) {
            mainwindow_exitButton.setEnabled(enable);
        }

        if (enable) {
            mainwindow_panel.requestFocusInWindow();
        }
    }

    private void enterOrderWindow() {

        order_usernameLabel.setText(current_user);
        orderTable.setModel(orderDataTable);
    }

    private void initCustomKeyBind() {
//        // change focus travesal 
//        String selectNext = "selectNextColumnCell";
//        String selectPrev = "selectPreviousColumnCell";
//        ActionMap am = stockTable.getActionMap();
//        am.put(selectPrev, new PreviousFocusHandler());
//        am.put(selectNext, new NextFocusHandler());
//
//        ActionMap actm = searchOrderTable.getActionMap();
//        actm.put(selectNext, new NextFocusHandler());
//        actm.put(selectPrev, new PreviousFocusHandler());
//        
//        ActionMap actm2 = dailyReport_table.getActionMap();
//        actm2.put(selectNext, new NextFocusHandler());
//        actm2.put(selectPrev, new PreviousFocusHandler());
//        
//        ActionMap actm3 = monthlyReport_table.getActionMap();
//        actm3.put(selectNext, new NextFocusHandler());
//        actm3.put(selectPrev, new PreviousFocusHandler());
//


        // exit button main window

        String exitEsc = "logoutEsc";
        mainwindow_exitButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), exitEsc);
        mainwindow_exitButton.getActionMap().put(exitEsc, new EscKeyAction(Constants.WindowID.MAIN_WINDOW_ID));

        // Stock Button Main Window



        String stockEsc = "stockEsc";
        stock_backButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), stockEsc);
        stock_backButton.getActionMap().put(stockEsc, new EscKeyAction(Constants.WindowID.STOCK_MANAGMENT_WINDOW_ID));

        String stockselectDown = "stockselectDown";
        stockTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "none");
        stockTable.getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), stockselectDown);
        stockTable.getActionMap().put(stockselectDown, new StockTableDownArrowKeyAction());

        String stockselectUp = "stockselectUp";
        stockTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "none");
        stockTable.getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), stockselectUp);
        stockTable.getActionMap().put(stockselectUp, new StockTableUpArrowKeyAction());
        // Add Items Window shortcuts 

        String addItemsEsc = "addItemsEsc";
        addItemsBackButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), addItemsEsc);
        addItemsBackButton.getActionMap().put(addItemsEsc, new EscKeyAction(Constants.WindowID.ADD_ITEMS_WINDOW_ID));

        // User Managment Button Main Window

        // User Managment Window shortcuts

        String usermanagementEsc = "usermanagementEsc";
        userManagement_BackButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), usermanagementEsc);
        userManagement_BackButton.getActionMap().put(usermanagementEsc, new EscKeyAction(Constants.WindowID.USER_MANAGMENT_WINDOW_ID));


        String userselectDown = "userselectDown";
        userTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "none");
        userTable.getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), userselectDown);
        userTable.getActionMap().put(userselectDown, new UserTableDownArrowKeyAction());

        String userselectUp = "selectUp";
        userTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "none");
        userTable.getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), userselectUp);
        userTable.getActionMap().put(userselectUp, new UserTableUpArrowKeyAction());


        // Add user window shortcuts

        String addUserEsc = "addUserEsc";
        addUser_backButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), addUserEsc);
        addUser_backButton.getActionMap().put(addUserEsc, new EscKeyAction(Constants.WindowID.ADD_USER_WINDOW_ID));


        // start Sale button Main window

        // order window keyboard shortcuts

        String orderEsc = "orderEsc";
        order_backButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), orderEsc);
        order_backButton.getActionMap().put(orderEsc, new EscKeyAction(Constants.WindowID.ORDER_WINDOW_ID));
        
                String orderDown = "orderDown";
        orderTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "none");
        orderTable.getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), orderDown);
        orderTable.getActionMap().put(orderDown, new OrderTableDownArrowKeyAction());

        String orderUp = "orderUp";
        orderTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "none");
        orderTable.getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), orderUp);
        orderTable.getActionMap().put(orderUp, new OrderTableUpArrowKeyAction());


        // Daily Report window 

        String dailyReportEsc = "dailyReportEsc";
        dailyReports_backButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), dailyReportEsc);
        dailyReports_backButton.getActionMap().put(dailyReportEsc, new EscKeyAction(Constants.WindowID.DAILY_REPORTS_WINDOW_ID));


        // Monthly Report window

        String monthlyReportEsc = "monthlyReportEsc";
        monthlyReports_backButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), monthlyReportEsc);
        monthlyReports_backButton.getActionMap().put(monthlyReportEsc, new EscKeyAction(Constants.WindowID.MONTHLY_REPORTS_WINDOW_ID));

        // item search window shortcuts
        String selVal = "SelectValue";
        itemSearchTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "none");
        itemSearchTable.getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), selVal);
        itemSearchTable.getActionMap().put(selVal, new EnterSearchResultsAction());

        String itemAccept = "orderAccept";
        orderItem_qtyField.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "none");
        orderItem_qtyField.getInputMap(JTextField.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), itemAccept);
        orderItem_qtyField.getActionMap().put(itemAccept, new EnterOrderAcceptAction());

        String selectDown = "selectDown";
        itemSearchTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "none");
        itemSearchTable.getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), selectDown);
        itemSearchTable.getActionMap().put(selectDown, new ItemSearchTableDownArrowKeyAction());

        String selectUp = "selectUp";
        itemSearchTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "none");
        itemSearchTable.getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), selectUp);
        itemSearchTable.getActionMap().put(selectUp, new ItemSearchTableUpArrowKeyAction());

        String itemSearchEsc = "itemSearchEsc";
        searchByCode_Field.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), itemSearchEsc);
        searchByCode_Field.getActionMap().put(itemSearchEsc, new EscKeyAction(Constants.WindowID.ITEM_SEARCH_WINDOW_ID));

        // pay window shortcuts

        // others

        // Edit Item window shortcuts


        // nextCustomer_Manin window shortcuts

        // exit conform dialog shortcuts
        String exit_yes = "exit_yes";
        exitDialog_yesButton.getInputMap(JButton.WHEN_IN_FOCUSED_WINDOW)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_Y, Event.CTRL_MASK), exit_yes);
        exitDialog_yesButton.getActionMap().put(exit_yes, new ExitYesKeyAction());
        String exit_no = "exit_no";
        exitDialog_noButton.getInputMap(JButton.WHEN_IN_FOCUSED_WINDOW)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK), exit_no);
        exitDialog_noButton.getActionMap().put(exit_no, new ExitNoKeyAction());
        String exit_cancel = "exit_cancel";
        exitDialog_cancelButton.getInputMap(JButton.WHEN_IN_FOCUSED_WINDOW)
                .put(KeyStroke.getKeyStroke(KeyEvent.VK_M, Event.CTRL_MASK), exit_cancel);
        exitDialog_cancelButton.getActionMap().put(exit_cancel, new ExitCancelKeyAction());
    }

    private void updateInvoiceTable(Order order) throws SQLException {
        db_Connector.insert(DBConstant.INVOICE_TABLE, new String[]{DBConstant.INVOICE_INVOICE, DBConstant.INVOICE_USER,
                    DBConstant.INVOICE_ITEM_COUNT, DBConstant.INVOICE_TOTAL, DBConstant.INVOICE_DATE}, new String[]{order.getInvoiceNum(),
                    order.getUserName(), order.getItemCount() + "", order.getTotalAsMoneyString() + ""});

        updateOrderTable(order);

    }

    private void updateOrderTable(Order order) throws SQLException {
        String invoice = order.getInvoiceNum();
        int i = 0;
        for (OrderItem item : order.getItems()) {
            db_Connector.insert(invoice, ++i, item);
        }
    }

    private void refreshDailyReportTable() {
        String y = String.valueOf(dailyReport_yearCombo.getSelectedItem());
        String m = String.valueOf(dailyReport_monthCombo.getSelectedItem());
        String d = String.valueOf(dailyReport_dayCombo.getSelectedItem());
        String date = GuiUtil.getReportDate(y, m, d);
        try {
            dailyReport_table.setModel(new ReportDataTable(db_Connector.select("SELECT * FROM " + DBConstant.DATABASE + "." + DBConstant.INVOICE_TABLE_DB_STRING + " WHERE `Date`='" + date + "'")));
        } catch (SQLException ex) {
            System.out.println("Error while updateing daily reports on " + date);
        }

    }

    private void refreshMonthlyReportTable() {
        String y = String.valueOf(monthlyReport_yearCombo.getSelectedItem());
        String m = String.valueOf(monthlyReport_monthCombo.getSelectedItem());
        String date = GuiUtil.getReportDate(y, m, "");
        try {
            monthlyReport_table.setModel(new ReportDataTable(db_Connector.select("SELECT * FROM " + DBConstant.DATABASE + "." + DBConstant.INVOICE_TABLE_DB_STRING + " WHERE `Date` LIKE '" + date + "%'")));
        } catch (SQLException ex) {
            System.out.println("Error while updateing monthly reports on " + date);
        }

    }

    private void setPrivilage(Role role) {
        if (role == Role.ADMINSTRATOR) {
        } else if (role == Role.MANAGER) {
        } else if (role == Role.EMPLOYEE) {
            mainwindow_stockManagmentButton.setEnabled(false);
            mainwindow_usermanagmentButton.setEnabled(false);
        } else if (role == Role.USER) {
            mainwindow_startButton.setEnabled(false);
            mainwindow_stockManagmentButton.setEnabled(false);
            mainwindow_usermanagmentButton.setEnabled(false);
        }
    }



    private class ExitYesKeyAction extends AbstractAction {

        public ExitYesKeyAction() {
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            exitDialog_yesButtonActionPerformed(e);
        }
    }

    private class ExitNoKeyAction extends AbstractAction {

        public ExitNoKeyAction() {
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            exitDialog_noButtonActionPerformed(e);
        }
    }

    private class ExitCancelKeyAction extends AbstractAction {

        public ExitCancelKeyAction() {
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            exitDialog_cancelButtonActionPerformed(e);
        }
    }

    private class AdduserFocusTravel extends FocusTraversalPolicy {

        @Override
        public Component getComponentAfter(Container aContainer, Component aComponent) {
            if (aComponent.equals(addUser_nameField)) {
                return addUser_passwordField;
            } else if (aComponent.equals(addUser_passwordField)) {
                return addUser_rePasswordField;
            } else if (aComponent.equals(addUser_rePasswordField)) {
                return addUser_roleComboBox;
            } else if (aComponent.equals(addUser_roleComboBox)) {
                return addUser_addButton;
            } else if (aComponent.equals(addUser_addButton)) {
                return addUser_cancelButton;
            } else if (aComponent.equals(addUser_cancelButton)) {
                return addUser_backButton;
            } else if (aComponent.equals(addUser_backButton)) {
                return addUser_nameField;
            } else {
                return aContainer;
            }
        }

        @Override
        public Component getComponentBefore(Container aContainer, Component aComponent) {
            if (aComponent.equals(addUser_passwordField)) {
                return addUser_nameField;
            } else if (aComponent.equals(addUser_rePasswordField)) {
                return addUser_passwordField;
            } else if (aComponent.equals(addUser_roleComboBox)) {
                return addUser_rePasswordField;
            } else if (aComponent.equals(addUser_addButton)) {
                return addUser_roleComboBox;
            } else if (aComponent.equals(addUser_cancelButton)) {
                return addUser_addButton;
            } else if (aComponent.equals(addUser_backButton)) {
                return addUser_cancelButton;
            } else if (aComponent.equals(addUser_nameField)) {
                return addUser_backButton;
            } else {
                return aContainer;
            }
        }

        @Override
        public Component getFirstComponent(Container aContainer) {
            return addUser_nameField;
        }

        @Override
        public Component getLastComponent(Container aContainer) {
            return addUser_backButton;
        }

        @Override
        public Component getDefaultComponent(Container aContainer) {
            return addUser_nameField;
        }
    }

    private class MainPanelFocusTraversalPolicy extends FocusTraversalPolicy {

        @Override
        public Component getComponentAfter(Container aContainer, Component aComponent) {
            if (aComponent.equals(mainwindow_stockManagmentButton)) {
                return mainwindow_usermanagmentButton;
            } else if (aComponent.equals(mainwindow_usermanagmentButton)) {
                return mainwindow_startButton;
            } else if (aComponent.equals(mainwindow_startButton)) {
                return mainwindow_stockManagmentButton;
            }

            return aComponent;

        }

        @Override
        public Component getComponentBefore(Container aContainer, Component aComponent) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Component getFirstComponent(Container aContainer) {
            return mainwindow_stockManagmentButton;
        }

        @Override
        public Component getLastComponent(Container aContainer) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Component getDefaultComponent(Container aContainer) {
            return mainwindow_stockManagmentButton;
        }
    }

    private class ItemSearchFocusTravel extends FocusTraversalPolicy {

        @Override
        public Component getComponentAfter(Container aContainer, Component aComponent) {
            if (aComponent.equals(searchByCode_Field)) {
                return searchByName_Field;
            } else if (aComponent.equals(searchByName_Field)) {
                return searchByCode_Field;
            } else {
                return searchByCode_Field;
            }
        }

        @Override
        public Component getComponentBefore(Container aContainer, Component aComponent) {
            if (aComponent.equals(searchByCode_Field)) {
                return searchByName_Field;
            } else if (aComponent.equals(searchByName_Field)) {
                return searchByCode_Field;
            } else {
                return searchByName_Field;
            }
        }

        @Override
        public Component getFirstComponent(Container aContainer) {
            return searchByCode_Field;
        }

        @Override
        public Component getLastComponent(Container aContainer) {
            return searchByName_Field;
        }

        @Override
        public Component getDefaultComponent(Container aContainer) {
            return searchByCode_Field;
        }
    }

    private class UsermanagmentFocusTraversalPolicy extends FocusTraversalPolicy {

        @Override
        public Component getComponentAfter(Container aContainer, Component aComponent) {
            if (aComponent.equals(userManagement_addUserButton)) {
                return userManagement_editUserButton;
            } else if (aComponent.equals(userManagement_editUserButton)) {
                return userManagement_deleteUserButton;
            } else if (aComponent.equals(userManagement_deleteUserButton)) {
                return userManagement_BackButton;
            } else if (aComponent.equals(userManagement_BackButton)) {
                return userManagement_addUserButton;
            }
            return aComponent;
        }

        @Override
        public Component getComponentBefore(Container aContainer, Component aComponent) {
            if (aComponent.equals(userManagement_editUserButton)) {
                return userManagement_addUserButton;
            } else if (aComponent.equals(userManagement_deleteUserButton)) {
                return userManagement_editUserButton;
            } else if (aComponent.equals(userManagement_BackButton)) {
                return userManagement_deleteUserButton;
            } else if (aComponent.equals(userManagement_addUserButton)) {
                return userManagement_BackButton;
            }
            return aComponent;
        }

        @Override
        public Component getFirstComponent(Container aContainer) {
            return userManagement_addUserButton;
        }

        @Override
        public Component getLastComponent(Container aContainer) {
            return userManagement_BackButton;
        }

        @Override
        public Component getDefaultComponent(Container aContainer) {
            return userManagement_addUserButton;
        }
    }

    private class StockPanelFocusTraversalPolicy extends FocusTraversalPolicy {

        @Override
        public Component getComponentAfter(Container aContainer, Component aComponent) {
            if (aComponent.equals(stock_addButton)) {
                return stock_editButton;
            } else if (aComponent.equals(stock_editButton)) {
                return stock_deleteButton;
            } else if (aComponent.equals(stock_deleteButton)) {
                return stock_cancelButton;
            } else if (aComponent.equals(stock_cancelButton)) {
                return stock_backButton;
            } else if (aComponent.equals(stock_backButton)) {
                return stock_addButton;
            }
            return stock_addButton;
        }

        @Override
        public Component getComponentBefore(Container aContainer, Component aComponent) {
            if (aComponent.equals(stock_editButton)) {
                return stock_addButton;
            } else if (aComponent.equals(stock_deleteButton)) {
                return stock_editButton;
            } else if (aComponent.equals(stock_cancelButton)) {
                return stock_deleteButton;
            } else if (aComponent.equals(stock_backButton)) {
                return stock_cancelButton;
            } else if (aComponent.equals(stock_addButton)) {
                return stock_backButton;
            }
            return stock_addButton;
        }

        @Override
        public Component getFirstComponent(Container aContainer) {
            return stock_addButton;
        }

        @Override
        public Component getLastComponent(Container aContainer) {
            return stock_backButton;
        }

        @Override
        public Component getDefaultComponent(Container aContainer) {
            return stock_addButton;
        }
    }
    
    private class StockAddItemFocusTraversalPolicy extends FocusTraversalPolicy{

        @Override
        public Component getComponentAfter(Container aContainer, Component aComponent) {
           if(aComponent.equals(addItem_codeField)){
             return addItems_ItemNameField;  
           }else if(aComponent.equals(addItems_ItemNameField)){
             return addItems_sellerField;  
           }else if(aComponent.equals(addItems_sellerField)){
             return addItems_quantityField;  
           }else if(aComponent.equals(addItems_quantityField)){
             return addItems_priceField;  
           }else if(aComponent.equals(addItems_priceField)){
             return addItem_codeField;  
           }
           return getDefaultComponent(aContainer);
        }

        @Override
        public Component getComponentBefore(Container aContainer, Component aComponent) {
            if(aComponent.equals(addItems_priceField)){
                return addItems_quantityField;
            }else if(aComponent.equals(addItems_quantityField)){
                return addItems_sellerField;
            }else if(aComponent.equals(addItems_sellerField)){
                return addItems_ItemNameField;
            }else if(aComponent.equals(addItems_ItemNameField)){
                return addItem_codeField;
            }else if(aComponent.equals(addItem_codeField)){
                return addItems_priceField;
            }
            return getDefaultComponent(aContainer);
        }

        @Override
        public Component getFirstComponent(Container aContainer) {
            return addItem_codeField;
        }

        @Override
        public Component getLastComponent(Container aContainer) {
            return addItems_priceField;
        }

        @Override
        public Component getDefaultComponent(Container aContainer) {
            return addItem_codeField;
        }
        
    }

    private class SearchCodeFieldDocumentListener implements DocumentListener {

        @Override
        public void insertUpdate(DocumentEvent e) {
            String text = searchByCode_Field.getText();
            try {
                refreshSearchTable(text, false);
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(itemSearch_window, "Search Result Error pleace contact developers", "Error", JOptionPane.ERROR_MESSAGE);
            }
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            String text = searchByCode_Field.getText();
            try {
                refreshSearchTable(text, false);
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(itemSearch_window, "Search Result Error pleace contact developers", "Error", JOptionPane.ERROR_MESSAGE);
            }
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }
    }

    private class SearchNameFieldDocumentListener implements DocumentListener {

        @Override
        public void insertUpdate(DocumentEvent e) {
            String text = searchByName_Field.getText();
            try {
                refreshSearchTable(text, true);
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(itemSearch_window, "Search Result Error pleace contact developers", "Error", JOptionPane.ERROR_MESSAGE);
            }
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            String text = searchByCode_Field.getText();
            try {
                refreshSearchTable(text, true);
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(itemSearch_window, "Search Result Error pleace contact developers", "Error", JOptionPane.ERROR_MESSAGE);
            }
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }
    }

    private class ItemSearchTableDownArrowKeyAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            int sr = itemSearchTable.getSelectedRow();
            int rc = itemSearchTable.getRowCount();
            if (rc > 0) {
                if (sr < (rc - 1)) {
                    itemSearchTable.addRowSelectionInterval(sr + 1, sr + 1);
                } else if (sr == (rc - 1)) {
                    itemSearchTable.addRowSelectionInterval(0, 0);
                }
            }
        }
    }

    private class ItemSearchTableUpArrowKeyAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            int sr = itemSearchTable.getSelectedRow();
            int rc = itemSearchTable.getRowCount();
            if (rc > 0) {
                if (sr == 0 || sr == -1) {
                    itemSearchTable.addRowSelectionInterval(rc - 1, rc - 1);
                } else if (sr <= (rc - 1)) {
                    itemSearchTable.addRowSelectionInterval(sr - 1, sr - 1);
                }
            }
        }
    }

    private class StockTableDownArrowKeyAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            int sr = stockTable.getSelectedRow();
            int rc = stockTable.getRowCount();
            if (rc > 0) {
                if (sr < (rc - 1)) {
                    stockTable.addRowSelectionInterval(sr + 1, sr + 1);
                } else if (sr == (rc - 1)) {
                    stockTable.addRowSelectionInterval(0, 0);
                }
            }
        }
    }

    private class StockTableUpArrowKeyAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            int sr = stockTable.getSelectedRow();
            int rc = stockTable.getRowCount();
            if (rc > 0) {

                if (sr == 0 || sr == -1) {
                    stockTable.addRowSelectionInterval(rc - 1, rc - 1);
                } else if (sr <= (rc - 1)) {
                    stockTable.addRowSelectionInterval(sr - 1, sr - 1);
                }
            }
        }
    }

    private class UserTableDownArrowKeyAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            int sr = userTable.getSelectedRow();
            int rc = userTable.getRowCount();
            if (rc > 0) {

                if (sr < (rc - 1)) {
                    userTable.addRowSelectionInterval(sr + 1, sr + 1);
                } else if (sr == (rc - 1)) {
                    userTable.addRowSelectionInterval(0, 0);
                }
            }
        }
    }

    private class UserTableUpArrowKeyAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            int sr = userTable.getSelectedRow();
            int rc = userTable.getRowCount();
            if (rc > 0) {
                if (sr == 0 || sr == -1) {
                    userTable.addRowSelectionInterval(rc - 1, rc - 1);
                } else if (sr <= (rc - 1)) {
                    userTable.addRowSelectionInterval(sr - 1, sr - 1);
                }
            }
        }
    }
    
    private class OrderTableDownArrowKeyAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            int sr = orderTable.getSelectedRow();
            int rc = orderTable.getRowCount();
            if (rc > 0) {
                if (sr < (rc - 1)) {
                    orderTable.addRowSelectionInterval(sr + 1, sr + 1);
                } else if (sr == (rc - 1)) {
                    orderTable.addRowSelectionInterval(0, 0);
                }
            }
        }
    }

    private class OrderTableUpArrowKeyAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            int sr = orderTable.getSelectedRow();
            int rc = orderTable.getRowCount();
            if (rc > 0) {
                if (sr == 0 || sr == -1) {
                    orderTable.addRowSelectionInterval(rc - 1, rc - 1);
                } else if (sr <= (rc - 1)) {
                    orderTable.addRowSelectionInterval(sr - 1, sr - 1);
                }
            }
        }
    }

    private class EnterSearchResultsAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            int i = itemSearchTable.getSelectedRow();
            String code = (String) itemSearchTable.getValueAt(i, 0);
            String name = (String) itemSearchTable.getValueAt(i, 1);
            String seller = (String) itemSearchTable.getValueAt(i, 2);
            String qty = (String) itemSearchTable.getValueAt(i, 3);
            String price = (String) itemSearchTable.getValueAt(i, 4);
            if (qty.equals(DBConstant.STOCK_NA)) {
                GuiUtil.showInfoMessage(itemSerach_panel, "Out of stock", "Empty Stock");
            } else {
                lineDisplay(price, "0");
                orderItem_codeLabel.setText(code);
                orderItem_nameLabel.setText(name);
                orderItem_sellerLabel.setText(seller);
                orderItem_priceLabel1.setText(price);
                orderItem_qtyLabel.setText(qty);
                orderItem_qtyField.setText("");
                itemSearch_window.setVisible(false);
                searchByCode_Field.setText("");
                searchByName_Field.setText("");
                orderItemAdd_window.setLocationRelativeTo(orderItemAdd_window);
                orderItemAdd_window.setVisible(true);
            }
        }
    }

    public class EnterOrderAcceptAction extends AbstractAction {

        @Override
        public void actionPerformed(ActionEvent e) {
            String val = orderItem_qtyField.getText();
            if (!val.equals("")) {
                try {
                    int qty = Integer.parseInt(val);
                    String qty_s = orderItem_qtyLabel.getText();

                    int stock_qty = Integer.valueOf(qty_s);
                    if (stock_qty < qty) {
                        GuiUtil.showInfoMessage(orderItemAdd_Panel, "Stock out of bound. please enter lower qty", "Stock out of bound");
                        
                    } else {
                        lineDisplay(val, "0");
                        OrderItem item = new OrderItem(orderItem_nameLabel.getText(),
                                orderItem_codeLabel.getText(),
                                orderItem_sellerLabel.getText(),
                                qty,
                                Double.parseDouble(orderItem_priceLabel1.getText()));
                        lineDisplay(item.getTotalPriceAsMoneyString(), "0");
                        if (order == null) {
                            order = new Order(getInvoiceNum(), current_user);
                            order_invoiceLabel.setText(order.getInvoiceNum());
                        }

                        order.addOrderItem(item);
                        lineDisplay(order.getTotalAsMoneyString() + "", "1");
                        orderDataTable.addItem(item);
                        orderItemAdd_window.setVisible(false);
                        order_totalLabel.setText(String.valueOf(order.getTotalAsMoneyString()));
                    }
                } catch (NumberFormatException ex) {
                    JOptionPane.showMessageDialog(orderItemAdd_window, "Please enter valid value for quntaity", "NumberFormate Error", JOptionPane.WARNING_MESSAGE);
                }

            } else {
                GuiUtil.showInfoMessage(orderItemAdd_Panel, "Enter quantity to buy", "Enter value");
            }
        }
    }

    private enum Action {

        START,
        MAIN_WINDOW,
        STOCK_WINDOW,
        STOCK_WINDOW_ADD,
        STOCK_WINDOW_EDIT,
        STOCK_WINDOW_DELETE,
        STOCK_WINDOW_CANCEL,
        STOCK_WINDOW_BACK,
        USER_MANAGMENT_WINDOW,
        USER_MANAGMENT_WINDOW_BACK,
        DAILY_REPORTS_WINDOW,
        DAILY_REPORTS_WINDOW_BACK,
        MONTHLY_REPORT_WINDOW,
        MONTHLY_REPORT_WINDOW_BACK,
        OEDER_WINDOW,
        OEDER_WINDOW_PAY,
        OEDER_WINDOW_ADD,
        OEDER_WINDOW_REMOVE,
        OEDER_WINDOW_CANCEL,
        OEDER_WINDOW_BACK,
        EXIT_WINDOW;
    }


    public class EscKeyAction extends AbstractAction {

        Constants.WindowID id;

        public EscKeyAction(Constants.WindowID id) {
            this.id = id;
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            if (Constants.WindowID.USER_MANAGMENT_WINDOW_ID == id) {
                userManagement_BackButtonActionPerformed(e);
            } else if (Constants.WindowID.ADD_ITEMS_WINDOW_ID == id) {
                addItemsBackButtonActionPerformed(e);
            } else if (Constants.WindowID.DAILY_REPORTS_WINDOW_ID == id) {
                dailyReports_backButtonActionPerformed(e);
            } else if (Constants.WindowID.MONTHLY_REPORTS_WINDOW_ID == id) {
                monthlyReports_backButtonActionPerformed(e);
            } else if (Constants.WindowID.ADD_USER_WINDOW_ID == id) {
                addUser_backButtonActionPerformed(e);
            } else if (Constants.WindowID.ITEM_SEARCH_WINDOW_ID == id) {
                itemSearch_windowWindowClosing(null);
            } else if (Constants.WindowID.ORDER_WINDOW_ID == id) {
                order_backButtonActionPerformed(e);
            } else if (Constants.WindowID.STOCK_MANAGMENT_WINDOW_ID == id) {
                stock_backButtonActionPerformed(e);
            } else if (Constants.WindowID.MAIN_WINDOW_ID == id) {
                mainwindow_exitButtonActionPerformed(e);
//       }else if(Constants.WindowID.PAY_WINDOW_ID== id){
//           pay_cancelButtonActionPerformed(e);
//       }else if(Constants.WindowID.LOGIN_WINDOW_ID==id){
//           login_WindowWindowClosing(null);
//       }else if(Constants.WindowID.VIEW_USER_WINDOW_ID==id){
//           viewUser_backButtonActionPerformed(e);
            }
        }
    }
}
